Merge branch 'master' into stable

This commit is contained in:
Tamius Han 2020-02-11 20:01:33 +01:00
commit 4fa1cb5cbc
6 changed files with 31 additions and 30 deletions

View File

@ -20,6 +20,7 @@ QoL improvements for me:
* Changed links to reflect my github username change
* **[4.4.4.1]** Fix broken extension popup.
* **[4.4.4.1]** Fix global/site settings not getting applied immediately/only getting applied after page reload.
* **[4.4.4.2]** Fix problem with video being offset while switching between full screen and non-fullscreen non-theater mode on Youtube
### v4.4.3

View File

@ -136,9 +136,7 @@ class PlayerData {
doPeriodicPlayerElementChangeCheck() {
if (this.periodicallyRefreshPlayerElement) {
if (this.forceDetectPlayerElementChange()) {
this.videoData.resizer.restore();
}
this.forceDetectPlayerElementChange();
}
}
@ -208,11 +206,22 @@ class PlayerData {
updatePlayerDimensions(element) {
const isFullScreen = PlayerData.isFullScreen();
if (element.offsetWidth !== this.dimensions?.width
|| element.offsetHeight !== this.dimensions?.height
|| isFullScreen !== this.dimensions?.fullscreen) {
// update dimensions only if they've changed, _before_ we do a restore (not after)
this.dimensions = {
width: element.offsetWidth,
height: element.offsetHeight,
fullscreen: isFullScreen
};
// actually re-calculate zoom when player size changes, but only if videoData.resizer
// is defined. Since resizer needs a PlayerData object to exist, videoData.resizer will
// be undefined the first time this function will run.
this.videoData.resizer?.restore();
}
}
getPlayer() {
@ -373,17 +382,11 @@ class PlayerData {
}
forceDetectPlayerElementChange() {
// save current dimensions before refreshing the player object
const oldDimensions = this.dimensions;
// Player dimension changes get calculated every time updatePlayerDimensions is called (which happens
// every time getPlayer() detects an element). If updatePlayerDimension detects dimensions were changed,
// it will always re-apply current crop, rendering this function little more than a fancy alias for
// getPlayer().
this.getPlayer();
// compare new player object dimensions with the old dimensions
// don't fucking trigger changes if nothing changed
if (this.dimensions.width === this.dimensions.width && this.dimensions.height === this.dimensions.height) {
return false;
} else {
return true;
}
}
forceRefreshPlayerElement() {

View File

@ -35,6 +35,8 @@ class VideoData {
return;
}
this.resizer = new Resizer(this);
const ths = this;
this.observer = new MutationObserver( (m, o) => this.onVideoDimensionsChanged(m, o, ths));
this.observer.observe(video, observerConf);
@ -44,7 +46,6 @@ class VideoData {
height: this.video.offsetHeight,
};
this.resizer = new Resizer(this);
this.arDetector = new ArDetector(this); // this starts Ar detection. needs optional parameter that prevets ardetdctor from starting
// player dimensions need to be in:
@ -158,12 +159,7 @@ class VideoData {
&& this.isWithin(vh, (ph - (translateY * 2)), 2)
&& this.isWithin(vw, (pw - (translateX * 2)), 2)) {
} else {
if (this.player.forceDetectPlayerElementChange()) {
this.logger.log('info', 'debug', "Video dimensions changed. Triggering restoreAr()");
this.restoreAr();
} else {
this.logger.log('info', 'playerRescan', "Video dimensions didn't change.");
}
this.player.forceDetectPlayerElementChange();
}
} catch(e) {

View File

@ -77,8 +77,8 @@ class UW {
"resizer": true,
"scaler": true,
"stretcher": true,
// 'videoRescan': true,
// 'playerRescan': true,
// "videoRescan": true,
// "playerRescan": true,
"arDetect": true,
"arDetect_verbose": true
},

View File

@ -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.4.4.1",
"version": "4.4.4.2",
"applications": {
"gecko": {
"id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}"

View File

@ -2,13 +2,14 @@
<div>
<h2>What's new</h2>
<p>Full changelog for older versions <a href="https://github.com/tamius-han/ultrawidify/blob/master/CHANGELOG.md">is available here</a>.</p>
<p class="label">4.4.4</p>
<p class="label">4.4.4<small>.2</small></p>
<ul>
<li>Tab detection in extension popup has been made more accurate</li>
<li>QoL: Added user-accessible logger (to make fixing sites I can't access a bit easier)</li>
<li>Changed links to reflect my github username change</li>
<li><b>[4.4.4.1]</b> There were multiple reports about popup being broken. This issue should be resolved.</li>
<li><b>[4.4.4.1]</b> Setting global/site defaults should no longer require page reloads.</li>
<li><b>[4.4.4.2]</b> Fix problem with video being offset while switching between full screen and non-fullscreen non-theater mode on Youtube</li>
</ul>
</div>
</template>