diff --git a/CHANGELOG.md b/CHANGELOG.md index 346b51d..c04e575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,14 @@ QoL improvements for me: * logging: allow to enable logging at will and export said logs to a file -### v.4.4.0 (current) +### v.4.4.1 (current) + +* Changes to player detection that fix issues with vk +* Extension tries to avoid setting aspect ratio pointlessly +* (Hopefully) fixed mailto: and reddit compose links. +* When reporting bugs, email/reddit template now automatically gathers browser, extension version and OS. + +### v.4.4.0 * Russian users (and users of other non-latin keyboard layouts) can now use keyboard shortcuts by default, without having to rebind them manually. (NOTE: if you've changed keyboard shortcuts manually, this change will ***NOT*** be applied to your configuration.) * NOTE: when using non-latin layouts, 'zoom' shortcut (`z` by default) uses the position of 'Y' on QWERTY layout. @@ -20,6 +27,8 @@ QoL improvements for me: * Changing aspect ratio now resets zooming and panning. * Fixed bug where keyboard shortcuts would work while typing in certain text fields * Fixed minor bug with autodetection +* **[4.4.0.1]** fixed mailto and reddit compose links. When reporting issues via e-mail or reddit, extension version, browser +and OS are automatically included in email/reddit template. ### v4.3.1 diff --git a/package.json b/package.json index 9e6f7c4..0562f98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ultravidify", - "version": "4.4.0", + "version": "4.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/ext/conf/BrowserDetect.js b/src/ext/conf/BrowserDetect.js index 1d61eae..e6f4ca3 100644 --- a/src/ext/conf/BrowserDetect.js +++ b/src/ext/conf/BrowserDetect.js @@ -4,6 +4,7 @@ const BrowserDetect = { firefox: process.env.BROWSER === 'firefox', chrome: process.env.BROWSER === 'chrome', edge: process.env.BROWSER === 'edge', + processEnvBrowser: process.env.BROWSER, } if (Debug.debug) { diff --git a/src/ext/lib/Logger.js b/src/ext/lib/Logger.js index 104e4a0..ed009d9 100644 --- a/src/ext/lib/Logger.js +++ b/src/ext/lib/Logger.js @@ -120,27 +120,29 @@ class Logger { if (!this.conf.fileOptions.enabled || this.temp_disable) { return false; } - if (component.length ) { - for (const c in component) { - if (this.conf.fileOptions[component]) { - return this.conf.fileOptions[component]; + if (Array.isArray(component) && component.length ) { + for (const c of component) { + if (this.conf.fileOptions[c]) { + return this.conf.fileOptions[c]; } } - } - return this.conf.fileOptions[component]; + } else { + return this.conf.fileOptions[component]; + } } canLogConsole(component) { if (!this.conf.consoleOptions.enabled || this.temp_disable) { return false; } if (Array.isArray(component) && component.length) { - for (const c in component) { - if (this.conf.consoleOptions[component]) { - return this.conf.consoleOptions[component]; + for (const c of component) { + if (this.conf.consoleOptions[c]) { + return this.conf.consoleOptions[c]; } } - } - return this.conf.consoleOptions[component]; + } else { + return this.conf.consoleOptions[component]; + } } // level is unused as of now, but this may change in the future diff --git a/src/ext/lib/ar-detect/ArDetector.js b/src/ext/lib/ar-detect/ArDetector.js index 9976501..20a7231 100644 --- a/src/ext/lib/ar-detect/ArDetector.js +++ b/src/ext/lib/ar-detect/ArDetector.js @@ -489,7 +489,7 @@ class ArDetector { } this.logger.log('info', 'debug', `%c[ArDetect::processAr] <@${this.arid}> Triggering aspect ratio change. New aspect ratio: ${trueAr}`, _ard_console_change); - this.conf.resizer.setAr({type: AspectRatio.Automatic, ratio: trueAr}, {type: AspectRatio.Automatic, ratio: trueAr}); + this.conf.resizer.updateAr({type: AspectRatio.Automatic, ratio: trueAr}, {type: AspectRatio.Automatic, ratio: trueAr}); } clearImageData(id) { @@ -582,7 +582,7 @@ class ArDetector { // da je letterbox izginil. // If we don't detect letterbox, we reset aspect ratio to aspect ratio of the video file. The aspect ratio could // have been corrected manually. It's also possible that letterbox (that was there before) disappeared. - this.conf.resizer.setAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()}); + this.conf.resizer.updateAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()}); this.guardLine.reset(); this.noLetterboxCanvasReset = true; diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index b9f87bb..950466d 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -192,6 +192,16 @@ class PlayerData { return false; } + updatePlayerDimensions(element) { + const isFullScreen = PlayerData.isFullScreen(); + + this.dimensions = { + width: element.offsetWidth, + height: element.offsetHeight, + fullscreen: isFullScreen + }; + } + getPlayer() { const host = window.location.host; let element = this.video.parentNode; @@ -223,6 +233,7 @@ class PlayerData { element = element.parentNode; } if (element) { + this.updatePlayerDimensions(element); return element; } } else if (this.settings.active.sites[host].DOM.player.querySelectors) { @@ -256,7 +267,9 @@ class PlayerData { 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 playerElement = elementQ.sort( (a,b) => b.score - a.score)[0].element; + this.updatePlayerDimensions(playerElement); + return playerElement; } } } @@ -283,17 +296,20 @@ class PlayerData { score = 100; - - if (element.id.indexOf('player') !== -1) { // prefer elements with 'player' in id - score += 75; - } + // This entire section is disabled because of some bullshit on vk and some shady CIS streaming sites. + // Possibly removal of this criteria is not necessary, because there was also a bug with force player + // + + // if (element.id.indexOf('player') !== -1) { // prefer elements with 'player' in id + // score += 75; + // } // this has only been observed on steam - if (element.id.indexOf('movie') !== -1) { - score += 75; - } - if (element.classList.toString().indexOf('player') !== -1) { // prefer elements with 'player' in classlist, but a bit less than id - score += 50; - } + // if (element.id.indexOf('movie') !== -1) { + // score += 75; + // } + // if (element.classList.toString().indexOf('player') !== -1) { // prefer elements with 'player' in classlist, but a bit less than id + // score += 50; + // } score -= scorePenalty++; // prefer elements closer to