From 307d98b911927b76cb2c55342ccfbf166cd8326e Mon Sep 17 00:00:00 2001 From: Hermes Admin Date: Mon, 25 May 2026 00:12:57 +0800 Subject: [PATCH] fix: 60fps OFF toggle now takes effect without page reload (#1506) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: MediaSource.isTypeSupported and canPlayType patches were only installed when localStorage already contained it-codec or it-player30fps at page load time. If neither was set (fresh install or both features disabled), the overwrite() hook was never attached, so toggling 60fps OFF at runtime had no effect. Fix: Always install the patches (wrapped in IIFE to avoid polluting scope). The overwrite() function reads localStorage fresh on every invocation, so codec/30fps filtering activates dynamically when the setting changes — no reload needed. --- js&css/web-accessible/core.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js&css/web-accessible/core.js b/js&css/web-accessible/core.js index d6b919e6d..0249cd943 100644 --- a/js&css/web-accessible/core.js +++ b/js&css/web-accessible/core.js @@ -98,8 +98,13 @@ CODEC || 30FPS ---------------------------------------------------------------- Do not move, needs to be on top of first injected content file to patch HTMLMediaElement before YT player uses it. + + Patches are always installed so that toggling 60fps OFF or + codec blocking at runtime takes effect without a reload. + The overwrite() function reads localStorage fresh each call, + so activation is fully dynamic. --------------------------------------------------------------*/ -if (localStorage['it-codec'] || localStorage['it-player30fps']) { +(function () { function overwrite(self, callback, mime) { if (localStorage['it-codec']) { var re = new RegExp(localStorage['it-codec']); @@ -123,7 +128,7 @@ if (localStorage['it-codec'] || localStorage['it-player30fps']) { HTMLMediaElement.prototype.canPlayType = function (mime) { return overwrite(this, canPlayType, mime); } -}; +})(); /*-------------------------------------------------------------- # MESSAGES