From 98e1b264dea6043b1a34974c5c4ecdb6cbf58279 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 14 Sep 2023 11:13:58 -0400 Subject: [PATCH] Update scriptlets Allow smaller multipliers in nano-sib/nano-stb https://github.com/uBlockOrigin/uBlock-issues/issues/2808 Remove adfly-defuser, which is now unused. --- assets/resources/scriptlets.js | 78 +++------------------------------- 1 file changed, 7 insertions(+), 71 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index b7a0850c1..231e60058 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -1467,7 +1467,7 @@ function nanoSetIntervalBooster( if ( isNaN(delay) || isFinite(delay) === false ) { delay = 1000; } let boost = parseFloat(boostArg); boost = isNaN(boost) === false && isFinite(boost) - ? Math.min(Math.max(boost, 0.02), 50) + ? Math.min(Math.max(boost, 0.001), 50) : 0.05; self.setInterval = new Proxy(self.setInterval, { apply: function(target, thisArg, args) { @@ -1520,7 +1520,7 @@ function nanoSetTimeoutBooster( if ( isNaN(delay) || isFinite(delay) === false ) { delay = 1000; } let boost = parseFloat(boostArg); boost = isNaN(boost) === false && isFinite(boost) - ? Math.min(Math.max(boost, 0.02), 50) + ? Math.min(Math.max(boost, 0.001), 50) : 0.05; self.setTimeout = new Proxy(self.setTimeout, { apply: function(target, thisArg, args) { @@ -2477,74 +2477,6 @@ function golemDe() { /******************************************************************************/ -builtinScriptlets.push({ - name: 'adfly-defuser.js', - fn: adflyDefuser, -}); -// https://github.com/reek/anti-adblock-killer/issues/3774#issuecomment-348536138 -// https://github.com/uBlockOrigin/uAssets/issues/883 -function adflyDefuser() { - // Based on AdsBypasser - // License: - // https://github.com/adsbypasser/adsbypasser/blob/master/LICENSE - var isDigit = /^\d$/; - var handler = function(encodedURL) { - var var1 = "", var2 = "", i; - for (i = 0; i < encodedURL.length; i++) { - if (i % 2 === 0) { - var1 = var1 + encodedURL.charAt(i); - } else { - var2 = encodedURL.charAt(i) + var2; - } - } - var data = (var1 + var2).split(""); - for (i = 0; i < data.length; i++) { - if (isDigit.test(data[i])) { - for (var ii = i + 1; ii < data.length; ii++) { - if (isDigit.test(data[ii])) { - var temp = parseInt(data[i],10) ^ parseInt(data[ii],10); - if (temp < 10) { - data[i] = temp.toString(); - } - i = ii; - break; - } - } - } - } - data = data.join(""); - var decodedURL = window.atob(data).slice(16, -16); - window.stop(); - window.onbeforeunload = null; - window.location.href = decodedURL; - }; - try { - var val; - var flag = true; - window.Object.defineProperty(window, "ysmm", { - configurable: false, - set: function(value) { - if (flag) { - flag = false; - try { - if (typeof value === "string") { - handler(value); - } - } catch (err) { } - } - val = value; - }, - get: function() { - return val; - } - }); - } catch (err) { - window.console.error("Failed to set up Adfly bypasser!"); - } -} - -/******************************************************************************/ - builtinScriptlets.push({ name: 'disable-newtab-links.js', fn: disableNewtabLinks, @@ -3779,7 +3711,11 @@ function trustedReplaceXhrResponse( return textAfter; } get responseText() { - return this.response; + const response = this.response; + if ( typeof response !== 'string' ) { + return super.responseText; + } + return response; } }; }