From 8cfc699fe6910b1720ffe3cca4c077ea26429456 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 1 Sep 2019 01:17:49 +0200 Subject: [PATCH 1/4] Fix default extensionconf for reddit --- src/ext/conf/ExtensionConf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ext/conf/ExtensionConf.js b/src/ext/conf/ExtensionConf.js index 9a4d4ec..bf481c1 100644 --- a/src/ext/conf/ExtensionConf.js +++ b/src/ext/conf/ExtensionConf.js @@ -975,7 +975,7 @@ whatsNewChecked: true, player: { manual: true, useRelativeAncestor: false, - querySelectors: '.media-preview-content' + querySelectors: '.reddit-video-player-root, .media-preview-content' } }, css: '', @@ -992,7 +992,7 @@ whatsNewChecked: true, player: { manual: true, useRelativeAncestor: false, - querySelectors: '.media-preview-content' + querySelectors: '.reddit-video-player-root, .media-preview-content' } }, css: '', From a67dbad21c922f82b5a5326822a6478b6e03560f Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 1 Sep 2019 01:40:39 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Fix=20player=20detection=20rules=20?= =?UTF-8?q?=E2=80=94=20for=20sites=20where=20query=20selector=20is=20defin?= =?UTF-8?q?ed=20as=20well?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ext/lib/video-data/PlayerData.js | 38 +++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index acbda74..bd3538c 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -237,6 +237,9 @@ class PlayerData { const host = window.location.host; let element = this.video.parentNode; const videoWidth = this.video.offsetWidth, videoHeight = this.video.offsetHeight; + const elementQ = []; + let scorePenalty = 0; + let score; if(! element ){ if(Debug.debug) { @@ -266,18 +269,41 @@ class PlayerData { } } else if (this.settings.active.sites[host].DOM.player.querySelectors) { const allSelectors = document.querySelectorAll(this.settings.active.sites[host].DOM.player.querySelectors); - while (element && !this.collectionHas(allSelectors, element)) { + + // actually we'll also score this branch in a similar way we score the regular, auto branch + while (element !== undefined) { + + // Let's see how this works + if (this.collectionHas(allSelectors, element)) { + score = 100; // every matching element gets a baseline 100 points + + // elements that match the size get a hefty bonus + if ( (element.offsetWidth >= videoWidth && this.equalish(element.offsetHeight, videoHeight, 2)) + || (element.offsetHeight >= videoHeight && this.equalish(element.offsetWidth, videoHeight, 2))) { + score += 75; + } + + // elements farther away from the video get a penalty + score -= (scorePenalty++) * 20; + + // push the element on the queue/stack: + elementQ.push({ + score: score, + element: element, + }); + } + element = element.parentNode; } - if (element) { - return element; + if (elementQ.length) { + // return element with biggest score + // if video player has not been found, proceed to automatic detection + return elementQ.sort( (a,b) => b.score - a.score)[0].element; } } } - const elementQ = []; - let scorePenalty = 0; - let score; + while (element != undefined){ // odstranimo Ĩudne elemente, ti bi pokvarili zadeve From 842851197e6f622c1ba201187bdd58241a4f2984 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 1 Sep 2019 01:41:12 +0200 Subject: [PATCH 3/4] Version bump related stuff --- CHANGELOG.md | 8 +++++--- package.json | 2 +- src/manifest.json | 2 +- src/popup/panels/WhatsNewPanel.vue | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54bac72..2d903c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,14 @@ * Settings page looks ugly af right now. Maybe fix it some time later -### v4.2.4 +### v4.2.4 / 4.2.4.x -* Improvements to player detection. More details in the [blog post](https://stuff.tamius.net/sacred-texts/2019/08/31/ultrawidify-and-the-improper-cropping/). +* Improvements to player detection. More details in the [blog post](https://stuff.tamius.net/sacred-texts/2019/08/31/ultrawidify-and-the-improper-cropping/). +* **[4.2.4.1]** Fixed default video settings for reddit +* **[4.2.4.1]** Manually specified query selectors will also be checked for compliance with player detection rules. -### v4.2.3 / 4.2.3.1 +### v4.2.3 / 4.2.3.x * Fixed twitchy behaviour on Twitch, Facebook and Twatter. Here's a [blog post](https://stuff.tamius.net/sacred-texts/2019/08/24/ultrawidify-the-twitchy-twitch-problem/) that covers the issue in more detail. * Cropping now uses user styles (as opposed to modifying element's style attribute) diff --git a/package.json b/package.json index 784df83..cc5b8c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ultravidify", - "version": "4.2.4", + "version": "4.2.4.1", "description": "Aspect ratio fixer for youtube that works around some people's disability to properly encode 21:9 (and sometimes, 16:9) videos.", "author": "Tamius Han ", "scripts": { diff --git a/src/manifest.json b/src/manifest.json index 0869dd4..b7c9529 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Ultrawidify", "description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.", - "version": "4.2.4", + "version": "4.2.4.1", "applications": { "gecko": { "id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}" diff --git a/src/popup/panels/WhatsNewPanel.vue b/src/popup/panels/WhatsNewPanel.vue index fe12d09..7617692 100644 --- a/src/popup/panels/WhatsNewPanel.vue +++ b/src/popup/panels/WhatsNewPanel.vue @@ -5,6 +5,8 @@

4.2.4

  • Improvements to player detection. More details in the blog post.
  • +
  • [4.2.4.1] Fixed default settings for reddit
  • +
  • [4.2.4.1] Manually specified query selectors are now also checked for compliance with player detection rules.

Chrome users: as a result of Chrome's shortcomings, there now exists one potential performance issue. If you notice any performance issues, please contact me via github, email or reddit (see: 'report a problem' tab From 49872ae16d7321095465984b5c60bfb48f3e3066 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 1 Sep 2019 01:41:51 +0200 Subject: [PATCH 4/4] package.json doesn't like fourth digit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc5b8c4..784df83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ultravidify", - "version": "4.2.4.1", + "version": "4.2.4", "description": "Aspect ratio fixer for youtube that works around some people's disability to properly encode 21:9 (and sometimes, 16:9) videos.", "author": "Tamius Han ", "scripts": {