diff --git a/README.md b/README.md index fa8030a..373bb61 100644 --- a/README.md +++ b/README.md @@ -75,18 +75,21 @@ Manually triggering aspect ratio change will suspend automatic aspect ratio dete ## Plans for the future -0. Memory leak bugfix (soon™) -1. Handle porting of extension settings between versions. (Some people had some issues where extension broke until reinstalled, and corrupted settings seemed to be the problem.) +~~1. Handle porting of extension settings between versions. (Some people had some issues where extension broke until reinstalled, and corrupted settings seemed to be the problem.)~~ seems to work for me? 2. Reintroduce gradual zoom on z and u and provide a way to 'scroll' the zoomed in video up/down left/right reintroduce settings page (rebindable keys, blacklist/whitelist management, some settings for automatic aspect ratio detection) -3. site-specific options for sites that require additional CSS classes or other hacks (see: vimeo, which is disable) +3. site-specific options for sites that require additional CSS classes or other hacks (see: vimeo, which is disabled) 4. figure the best way to do GUI (injecting buttons into the player bar is not a good way. Been there, done that, each site has its own way and some appear to be impossible). Might get bumped to be released alongside #2 5. Stretch mode, because some people are very salty and toxic about the fact that this extension is here to solve a problem that's different than the one they want. More salty than me rn. +6. Improvements to automatic aspect ratio detection ## Changelog +### v2.2.3 (AMO) -### v2.2.2 (AMO) +* Fixed automatic aspect ratio detection on DRM-protected sites. + +### v2.2.2 * Fixes problems with switching from normal to fullscreen player on youtube. If 2.2.1 didn't fix the font issue, this version should have. diff --git a/js/modules/ArDetect.js b/js/modules/ArDetect.js index 3bf92de..c6d08fe 100644 --- a/js/modules/ArDetect.js +++ b/js/modules/ArDetect.js @@ -139,6 +139,9 @@ var _arSetup = function(cwidth, cheight){ console.log("error:", ex); } + // we're also gonna reset this + GlobalVars.arDetect.guardLine.top = null; + GlobalVars.arDetect.guardLine.bottom = null; _ard_resetBlackLevel(); this._forcehalt = false; @@ -343,7 +346,6 @@ var _ard_vdraw_but_for_reals = function() { // canvas needs to be resized, so let's change setup _ard_stop(); - console.log("globalvars corrected video dimensions is null"); var newCanvasWidth = window.innerHeight * (GlobalVars.video.videoWidth / GlobalVars.video.videoHeight); var newCanvasHeight = window.innerHeight; @@ -492,7 +494,7 @@ var _ard_vdraw_but_for_reals = function() { } } - imageDetectOut = _ard_guardLineImageDetect(image); + imageDetectOut = _ard_guardLineImageDetect(image, fallbackMode); imageDetectResult = imageDetectOut.success; // če sta obe funkciji uspeli, potem se razmerje stranic ni spremenilo. @@ -923,7 +925,7 @@ var _ard_findBlackbarLimits = function(image, cols, guardLineResult, imageDetect return {res_top: res_top, res_bottom: res_bottom}; } -var _ard_guardLineImageDetect = function(image){ +var _ard_guardLineImageDetect = function(image, fallbackMode){ if(GlobalVars.arDetect.guardLine.top == null || GlobalVars.arDetect.guardLine.bottom == null) return { success: false }; @@ -938,9 +940,15 @@ var _ard_guardLineImageDetect = function(image){ // preglejmo obe vrstici - tukaj po pravilih ne bi smeli iti prek mej platna. ne rabimo preverjati // check both rows - by the rules and definitions, we shouldn't go out of bounds here. no need to check, then - var edge_upper = edges.top + ExtensionConf.arDetect.guardLine.edgeTolerancePx; - var edge_lower = edges.bottom - ExtensionConf.arDetect.guardLine.edgeTolerancePx; - +// if(fallbackMode){ +// var edge_upper = ExtensionConf.arDetect.fallbackMode.noTriggerZonePx; +// var edge_lower = GlobalVars.canvas.height - ExtensionConf.arDetect.fallbackMode.noTriggerZonePx - 1; +// } +// else{ + var edge_upper = edges.top + ExtensionConf.arDetect.guardLine.edgeTolerancePx; + var edge_lower = edges.bottom - ExtensionConf.arDetect.guardLine.edgeTolerancePx; +// } + // koliko pikslov rabimo zaznati, da je ta funkcija uspe. Tu dovoljujemo tudi, da so vsi piksli na enem // robu (eden izmed robov je lahko v celoti črn) // how many non-black pixels we need to consider this check a success. We only need to detect enough pixels @@ -973,6 +981,7 @@ var _ard_guardLineImageDetect = function(image){ for(var i = rowStart; i < rowEnd; i+=4){ if(image[i] > blackbarTreshold || image[i+1] > blackbarTreshold || image[i+2] > blackbarTreshold){ if(successTreshold --<= 0){ + return {success: true} } } diff --git a/manifest.json b/manifest.json index 5197f91..dfc5fb9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Ultrawidify", - "version": "2.2.3", + "version": "2.2.3.1", "icons": { "32":"res/icons/uw-32.png",