1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

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.
This commit is contained in:
Raymond Hill 2023-09-14 11:13:58 -04:00
parent c7535f1eda
commit 98e1b264de
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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;
}
};
}