From 8ec11736383fb3d38675626e32392b3f7bb50bfa Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Mon, 29 Apr 2024 07:12:21 +0200 Subject: [PATCH] Update player.js unmangle --- js&css/web-accessible/www.youtube.com/player.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js&css/web-accessible/www.youtube.com/player.js b/js&css/web-accessible/www.youtube.com/player.js index 5bd20f2e3..b8328b770 100644 --- a/js&css/web-accessible/www.youtube.com/player.js +++ b/js&css/web-accessible/www.youtube.com/player.js @@ -495,7 +495,8 @@ ImprovedTube.playerAutofullscreen = function () { QUALITY ------------------------------------------------------------------------------*/ ImprovedTube.playerQuality = function (quality = this.storage.player_quality) { - if (quality && (let player = this.elements.player) && player.getAvailableQualityLevels + let player = this.elements.player; + if (quality && player && player.getAvailableQualityLevels && (!player.dataset.defaultQuality || player.dataset.defaultQuality != quality)) { let available_quality_levels = player.getAvailableQualityLevels(); function closest(num, arr) { @@ -526,16 +527,17 @@ ImprovedTube.playerQuality = function (quality = this.storage.player_quality) { QUALITY WITHOUT FOCUS ------------------------------------------------------------------------------*/ ImprovedTube.playerQualityWithoutFocus = function () { + let player = this.elements.player, qualityWithoutFocus = this.storage.player_quality_without_focus; - if (qualityWithoutFocus && qualityWithoutFocus !== 'auto' ) { + if (qualityWithoutFocus && qualityWithoutFocus !== 'auto' && player && player.getPlaybackQuality) { if (this.focus) { if (ImprovedTube.qualityBeforeBlur) { ImprovedTube.playerQuality(ImprovedTube.qualityBeforeBlur); - } + } } else { - if ((let player = this.elements.player) && player.getPlaybackQuality && !ImprovedTube.elements.video.paused) { - ImprovedTube.qualityBeforeBlur = player.getPlaybackQuality(); - ImprovedTube.playerQuality(qualityWithoutFocus); + if (!ImprovedTube.elements.video.paused) { + ImprovedTube.qualityBeforeBlur = player.getPlaybackQuality(); + ImprovedTube.playerQuality(qualityWithoutFocus); } } }