mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-16 10:10:20 +08:00
381 lines
51 KiB
JavaScript
381 lines
51 KiB
JavaScript
![]() |
/*******************************************************************************
|
||
|
|
||
|
uBlock Origin Lite - a comprehensive, MV3-compliant content blocker
|
||
|
Copyright (C) 2014-present Raymond Hill
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||
|
|
||
|
Home: https://github.com/gorhill/uBlock
|
||
|
|
||
|
*/
|
||
|
|
||
|
/* jshint esversion:11 */
|
||
|
/* global cloneInto */
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
// ruleset: default
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
// Important!
|
||
|
// Isolate from global scope
|
||
|
|
||
|
// Start of local scope
|
||
|
(( ) => {
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
// Start of code to inject
|
||
|
const uBOL_noSetTimeoutIf = function() {
|
||
|
|
||
|
const scriptletGlobals = {}; // jshint ignore: line
|
||
|
|
||
|
const argsList = [["push","500"],[".call(null)","10"],[".call(null)"],["(null)","10"],["userHasAdblocker"],["adb"],["nrWrapper"],["warn"],["adBlockerDetected"],["show"],["InfMediafireMobileFunc","1000"],["google_jobrunner"],["()","45000"],["0x"],["displayAdBlockedVideo"],[".adsbygoogle"],["isDesktopApp","1000"],["Bait"],["admc"],["AdBlocker"],["Blocked"],["ai_adb"],["match","100"],["'0x"],["apstagLOADED"],["/Adb|moneyDetect/"],["disableDeveloper"],["Blocco","2000"],["test","0"],["checkAdblockUser","1000"],["checkPub","6000"],["document.querySelector","5000"],["nextFunction","250"],["()","150"],["backRedirect"],["document.querySelectorAll","1000"],["style"],["clientHeight"],["addEventListener","0"],["adblock","2000"],["start","0"],["nextFunction","2000"],["byepopup","5000"],["test.remove","100"],["additional_src","300"],["()","2000"],["css_class.show"],["CANG","3000"],["updato-overlay","500"],["innerText","2000"],["alert","8000"],["css_class"],["()","50"],["debugger"],["initializeCourier","3000"],["redirectPage"],["_0x","2000"],["ads","750"],["location.href","500"],["Adblock","5000"],["disable","200"],["CekAab","0"],["rbm_block_active","1000"],["show()"],["_0x"],["n.trigger","1"],["adblock"],["abDetected"],["KeepOpeningPops","1000"],["location.href"],["appendChild"],["adb","0"],["adBlocked"],["warning","100"],["adblock_popup","500"],["Adblock"],["location.href","10000"],["#chatWrap","1000"],["keep-ads","2000"],["#rbm_block_active","1000"],["null","4000"],["()","2500"],["myaabpfun","3000"],["nextFunction"],["adFilled","2500"],["()","15000"],["showPopup"],["()","1"],["()","1000"],["document.cookie","2500"],["window.open"],["innerHTML"],["readyplayer","2000"],["checkStopBlock"],["adspot_top","1500"],["/offsetHeight|google|Global/"],["an_message","500"],["Adblocker","10000"],["timeoutChecker"],["bait","1"],["pum-open"],["overlay","2000"],["/adblock/i"],["test","100"],["Math.round","1000"],["adblock","5"],["bioEp"],["ag_adBlockerDetected"],["null"],["adb","6000"],["pop"],["sadbl"],["checkAdStatus"],["mdp"],["brave_load_popup"],["0x","3000"],["invoke"],["adsbytrafficjunkycontext"],["ipod"],["offsetWidth"],["/$|adBlock/"],["ads"],["adsbygoogle"],["()"],["AdBlock"],["stop-scrolling"],["Adv"],["blockUI","2000"],["mdpDeBlocker"],["/_0x|debug/"],["/ai_adb|_0x/"],["iframe"],["adBlock"],["","1"],["undefined"],["check","1"],["adsBlocked"],["blocker"],["aswift_"],["afs_ads","2000"],["visibility","2000"],["bait"],["getComputedStyle","250"],["blocked"],["{r()","0"],["nextFunction","450"],["Debug"],["r()","0"],["purple_box"],["offsetHeight"],["checkSiteNormalLoad"],["adBlockOverlay"],["Detected","500"],["modal"],[".show","1000"],[".show"],["showModal"],["getComputedStyle"],["blur"],["samOverlay"],["bADBlock"],["location"],["","4000"],["blocker","100"],["alert"],["length"],["t()","0"],["$"],["offset"],["contrformpub"],["trigger","0"],["popup"],["getComputedStyle","2000"],["video-popup"],["detectAdblock"],["EzoIvent"],["detectAdBlocker"],["nads"],["1e3*"],["current.children"],["adStatus"],["BN_CAMPAIGNS"],["media_place_list"],["cvad"],["...","300"],["/\\{[a-z]\\(!0\\)\\}/"],["error"],["stackTrace"],["inner-ad"],["_ET"],[".clientHeight"],["getComputedStyle(el)"],["location.replace"],["console.clear"],["ad_block_detector"],["documentElement.innerHTML"],["","5"],["/adblock|isRequestPresent/"],["_0x","500"],["isRequestPresent"],["adsPost"],["_0x","1000"],["offsetLeft"],["height"],["mdp_deblocker"],["charAt"],["checkAds"],["fadeIn","0"],["jQuery"],["/^/"],["afterOpen"],["check"],["Adblocker"],["eabdModal"],["ab_root.show"],["gaData"],["ad"],["prompt","1000"],["googlefc"],["adblock detection"],[".offsetHeight","100"],["popState"],["ad-block-popup"],["exitTimer"],["innerHTML.replace"],["ab","2000"],["data?","4000"],[".data?"],["eabpDialog"],["adsense"],["/Adblock|_ad_/"],["googletag"],["f.parentNode.removeChild(f)","100"],["swal","500"],["keepChecking","1000"],["openPopup"],[".offsetHeight"],["()=>{"],["nitroAds"],["class.scroll","1000"],["disableDeveloperTools"],["Check"],["insertBefore"],["css_class.scroll"],["/null|Error/","10000"],["window.loc
|
||
|
|
||
|
const hostnamesMap = new Map([["4-liga.com",1],["4fansites.de",1],["4players.de",1],["9monate.de",1],["aachener-nachrichten.de",1],["aachener-zeitung.de",1],["abendblatt.de",1],["abendzeitung-muenchen.de",1],["about-drinks.com",1],["abseits-ka.de",1],["airliners.de",1],["ajaxshowtime.com",1],["allgemeine-zeitung.de",1],["alpin.de",1],["antenne.de",1],["arcor.de",1],["areadvd.de",1],["areamobile.de",1],["ariva.de",1],["astronews.com",1],["aussenwirtschaftslupe.de",1],["auszeit.bio",1],["auto-motor-und-sport.de",1],["auto-service.de",1],["autobild.de",1],["autoextrem.de",1],["autopixx.de",1],["autorevue.at",1],["az-online.de",1],["baby-vornamen.de",1],["babyclub.de",1],["bafoeg-aktuell.de",1],["berliner-kurier.de",1],["berliner-zeitung.de",1],["bigfm.de",1],["bikerszene.de",1],["bildderfrau.de",1],["blackd.de",1],["blick.de",1],["boerse-online.de",1],["boerse.de",1],["boersennews.de",1],["braunschweiger-zeitung.de",1],["brieffreunde.de",1],["brigitte.de",1],["buerstaedter-zeitung.de",1],["buffed.de",1],["businessinsider.de",1],["buzzfeed.at",1],["buzzfeed.de",1],["caravaning.de",1],["cavallo.de",1],["chefkoch.de",1],["cinema.de",1],["clever-tanken.de",1],["computerbild.de",1],["computerhilfen.de",1],["comunio-cl.com",1],["connect.de",1],["chip.de",1],["da-imnetz.de",1],["dasgelbeblatt.de",1],["dbna.com",1],["dbna.de",1],["deichstube.de",1],["deine-tierwelt.de",1],["der-betze-brennt.de",1],["derwesten.de",1],["desired.de",1],["dhd24.com",1],["dieblaue24.com",1],["digitalfernsehen.de",1],["dnn.de",1],["donnerwetter.de",1],["e-hausaufgaben.de",1],["e-mountainbike.com",1],["eatsmarter.de",1],["echo-online.de",1],["ecomento.de",1],["einfachschoen.me",1],["elektrobike-online.com",1],["eltern.de",1],["epochtimes.de",1],["essen-und-trinken.de",1],["express.de",1],["extratipp.com",1],["familie.de",1],["fanfiktion.de",1],["fehmarn24.de",1],["fettspielen.de",1],["fid-gesundheitswissen.de",1],["finanznachrichten.de",1],["finanztreff.de",1],["finya.de",1],["firmenwissen.de",1],["fitforfun.de",1],["fnp.de",1],["football365.fr",1],["formel1.de",1],["fr.de",1],["frankfurter-wochenblatt.de",1],["freenet.de",1],["fremdwort.de",1],["froheweihnachten.info",1],["frustfrei-lernen.de",1],["fuldaerzeitung.de",1],["funandnews.de",1],["fussballdaten.de",1],["futurezone.de",1],["gala.de",1],["gamepro.de",1],["gamersglobal.de",1],["gamesaktuell.de",1],["gamestar.de",1],["gamezone.de",1],["gartendialog.de",1],["gartenlexikon.de",1],["gedichte.ws",1],["geissblog.koeln",1],["gelnhaeuser-tageblatt.de",1],["general-anzeiger-bonn.de",1],["geniale-tricks.com",1],["genialetricks.de",1],["gesund-vital.de",1],["gesundheit.de",1],["gevestor.de",1],["gewinnspiele.tv",1],["giessener-allgemeine.de",1],["giessener-anzeiger.de",1],["gifhorner-rundschau.de",1],["giga.de",1],["gipfelbuch.ch",1],["gmuender-tagespost.de",1],["golem.de",[1,8,9]],["gruenderlexikon.de",1],["gusto.at",1],["gut-erklaert.de",1],["gutfuerdich.co",1],["hallo-muenchen.de",1],["hamburg.de",1],["hanauer.de",1],["hardwareluxx.de",1],["hartziv.org",1],["harzkurier.de",1],["haus-garten-test.de",1],["hausgarten.net",1],["haustec.de",1],["haz.de",1],["heidelberg24.de",1],["heilpraxisnet.de",1],["heise.de",1],["helmstedter-nachrichten.de",1],["hersfelder-zeitung.de",1],["hftg.co",1],["hifi-forum.de",1],["hna.de",1],["hochheimer-zeitung.de",1],["hoerzu.de",1],["hofheimer-zeitung.de",1],["iban-rechner.de",1],["ikz-online.de",1],["immobilienscout24.de",1],["ingame.de",1],["inside-digital.de",1],["inside-handy.de",1],["investor-verlag.de",1],["jappy.com",1],["jpgames.de",1],["kabeleins.de",1],["kachelmannwetter.com",1],["kamelle.de",1],["kicker.de",1],["kindergeld.org",1],["klettern-magazin.de",1],["klettern.de",1],["kochbar.de",1],["kreis-anzeiger.de",1],["kreisbote.de",1],["kreiszeitung.de",1],["ksta.de",1],["kurierverlag.de",1],["lachainemeteo.com",1],["lampertheimer-zeitung.de",1],["landwirt.com",1],["laut.de",1],["lauterbacher-anzeiger.de",1],["leckerschmecker.me",1],["leinetal24.de",1],["lesfoodies.com",1],["levif.be",1],["lifeline.de",1],["liga3-online.de",1],["likemag.com",1],["linux-community.de",
|
||
|
|
||
|
const entitiesMap = new Map([["lablue",0],["comunio",1],["finanzen",[1,6]],["gameswelt",1],["heftig",1],["notebookcheck",1],["testedich",1],["transfermarkt",1],["truckscout24",1],["tvtv",1],["wetteronline",1],["wieistmeineip",1],["wetter",3],["1337x",5],["eztv",5],["sushi-scan",9],["spigotunlocked",9],["ahmedmode",9],["kissasian",12],["rp5",13],["mma-core",14],["yts",18],["720pstream",18],["1stream",18],["magesy",19],["shortzzy",21],["thefmovies",23],["urlcero",29],["totaldebrid",32],["sandrives",32],["fxporn69",41],["aliancapes",41],["pouvideo",43],["povvideo",43],["povw1deo",43],["povwideo",43],["powv1deo",43],["powvibeo",43],["powvideo",43],["powvldeo",43],["tubsexer",49],["porno-tour",49],["lenkino",49],["pornomoll",49],["camsclips",49],["m4ufree",53],["writedroid",64],["telerium",68],["pandafreegames",84],["thoptv",92],["streameast",111],["thestreameast",111],["daddylivehd",111],["solvetube",115],["hdfilme",116],["pornhub",117],["wcofun",124],["bollyholic",128],["gotxx",142],["turkanime",143],["voe-unblock",143],["khatrimaza",156],["pogolinks",156],["popcornstream",158],["brainly",170],["oploverz",171],["vembed",210],["xhamsterdeutsch",256],["privatemoviez",260],["gmx",276],["lightnovelpub",[305,306]],["camcaps",321],["drivebot",343],["thenextplanet1",344],["autoscout24",350]]);
|
||
|
|
||
|
const exceptionsMap = new Map([["panel.freemcserver.net",[282]]]);
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
function noSetTimeoutIf(
|
||
|
needle = '',
|
||
|
delay = ''
|
||
|
) {
|
||
|
if ( typeof needle !== 'string' ) { return; }
|
||
|
const safe = safeSelf();
|
||
|
const logPrefix = safe.makeLogPrefix('prevent-setTimeout', needle, delay);
|
||
|
const needleNot = needle.charAt(0) === '!';
|
||
|
if ( needleNot ) { needle = needle.slice(1); }
|
||
|
if ( delay === '' ) { delay = undefined; }
|
||
|
let delayNot = false;
|
||
|
if ( delay !== undefined ) {
|
||
|
delayNot = delay.charAt(0) === '!';
|
||
|
if ( delayNot ) { delay = delay.slice(1); }
|
||
|
delay = parseInt(delay, 10);
|
||
|
}
|
||
|
const reNeedle = safe.patternToRegex(needle);
|
||
|
self.setTimeout = new Proxy(self.setTimeout, {
|
||
|
apply: function(target, thisArg, args) {
|
||
|
const a = args[0] instanceof Function
|
||
|
? String(safe.Function_toString(args[0]))
|
||
|
: String(args[0]);
|
||
|
const b = args[1];
|
||
|
if ( needle === '' && delay === undefined ) {
|
||
|
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
|
||
|
return Reflect.apply(target, thisArg, args);
|
||
|
}
|
||
|
let defuse;
|
||
|
if ( needle !== '' ) {
|
||
|
defuse = reNeedle.test(a) !== needleNot;
|
||
|
}
|
||
|
if ( defuse !== false && delay !== undefined ) {
|
||
|
defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
|
||
|
}
|
||
|
if ( defuse ) {
|
||
|
args[0] = function(){};
|
||
|
safe.uboLog(logPrefix, `Prevented:\n${a}\n${b}`);
|
||
|
}
|
||
|
return Reflect.apply(target, thisArg, args);
|
||
|
},
|
||
|
get(target, prop, receiver) {
|
||
|
if ( prop === 'toString' ) {
|
||
|
return target.toString.bind(target);
|
||
|
}
|
||
|
return Reflect.get(target, prop, receiver);
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function safeSelf() {
|
||
|
if ( scriptletGlobals.safeSelf ) {
|
||
|
return scriptletGlobals.safeSelf;
|
||
|
}
|
||
|
const self = globalThis;
|
||
|
const safe = {
|
||
|
'Array_from': Array.from,
|
||
|
'Error': self.Error,
|
||
|
'Function_toStringFn': self.Function.prototype.toString,
|
||
|
'Function_toString': thisArg => safe.Function_toStringFn.call(thisArg),
|
||
|
'Math_floor': Math.floor,
|
||
|
'Math_max': Math.max,
|
||
|
'Math_min': Math.min,
|
||
|
'Math_random': Math.random,
|
||
|
'Object': Object,
|
||
|
'Object_defineProperty': Object.defineProperty.bind(Object),
|
||
|
'Object_defineProperties': Object.defineProperties.bind(Object),
|
||
|
'Object_fromEntries': Object.fromEntries.bind(Object),
|
||
|
'Object_getOwnPropertyDescriptor': Object.getOwnPropertyDescriptor.bind(Object),
|
||
|
'RegExp': self.RegExp,
|
||
|
'RegExp_test': self.RegExp.prototype.test,
|
||
|
'RegExp_exec': self.RegExp.prototype.exec,
|
||
|
'Request_clone': self.Request.prototype.clone,
|
||
|
'XMLHttpRequest': self.XMLHttpRequest,
|
||
|
'addEventListener': self.EventTarget.prototype.addEventListener,
|
||
|
'removeEventListener': self.EventTarget.prototype.removeEventListener,
|
||
|
'fetch': self.fetch,
|
||
|
'JSON': self.JSON,
|
||
|
'JSON_parseFn': self.JSON.parse,
|
||
|
'JSON_stringifyFn': self.JSON.stringify,
|
||
|
'JSON_parse': (...args) => safe.JSON_parseFn.call(safe.JSON, ...args),
|
||
|
'JSON_stringify': (...args) => safe.JSON_stringifyFn.call(safe.JSON, ...args),
|
||
|
'log': console.log.bind(console),
|
||
|
// Properties
|
||
|
logLevel: 0,
|
||
|
// Methods
|
||
|
makeLogPrefix(...args) {
|
||
|
return this.sendToLogger && `[${args.join(' \u205D ')}]` || '';
|
||
|
},
|
||
|
uboLog(...args) {
|
||
|
if ( this.sendToLogger === undefined ) { return; }
|
||
|
if ( args === undefined || args[0] === '' ) { return; }
|
||
|
return this.sendToLogger('info', ...args);
|
||
|
|
||
|
},
|
||
|
uboErr(...args) {
|
||
|
if ( this.sendToLogger === undefined ) { return; }
|
||
|
if ( args === undefined || args[0] === '' ) { return; }
|
||
|
return this.sendToLogger('error', ...args);
|
||
|
},
|
||
|
escapeRegexChars(s) {
|
||
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||
|
},
|
||
|
initPattern(pattern, options = {}) {
|
||
|
if ( pattern === '' ) {
|
||
|
return { matchAll: true };
|
||
|
}
|
||
|
const expect = (options.canNegate !== true || pattern.startsWith('!') === false);
|
||
|
if ( expect === false ) {
|
||
|
pattern = pattern.slice(1);
|
||
|
}
|
||
|
const match = /^\/(.+)\/([gimsu]*)$/.exec(pattern);
|
||
|
if ( match !== null ) {
|
||
|
return {
|
||
|
re: new this.RegExp(
|
||
|
match[1],
|
||
|
match[2] || options.flags
|
||
|
),
|
||
|
expect,
|
||
|
};
|
||
|
}
|
||
|
if ( options.flags !== undefined ) {
|
||
|
return {
|
||
|
re: new this.RegExp(this.escapeRegexChars(pattern),
|
||
|
options.flags
|
||
|
),
|
||
|
expect,
|
||
|
};
|
||
|
}
|
||
|
return { pattern, expect };
|
||
|
},
|
||
|
testPattern(details, haystack) {
|
||
|
if ( details.matchAll ) { return true; }
|
||
|
if ( details.re ) {
|
||
|
return this.RegExp_test.call(details.re, haystack) === details.expect;
|
||
|
}
|
||
|
return haystack.includes(details.pattern) === details.expect;
|
||
|
},
|
||
|
patternToRegex(pattern, flags = undefined, verbatim = false) {
|
||
|
if ( pattern === '' ) { return /^/; }
|
||
|
const match = /^\/(.+)\/([gimsu]*)$/.exec(pattern);
|
||
|
if ( match === null ) {
|
||
|
const reStr = this.escapeRegexChars(pattern);
|
||
|
return new RegExp(verbatim ? `^${reStr}$` : reStr, flags);
|
||
|
}
|
||
|
try {
|
||
|
return new RegExp(match[1], match[2] || undefined);
|
||
|
}
|
||
|
catch(ex) {
|
||
|
}
|
||
|
return /^/;
|
||
|
},
|
||
|
getExtraArgs(args, offset = 0) {
|
||
|
const entries = args.slice(offset).reduce((out, v, i, a) => {
|
||
|
if ( (i & 1) === 0 ) {
|
||
|
const rawValue = a[i+1];
|
||
|
const value = /^\d+$/.test(rawValue)
|
||
|
? parseInt(rawValue, 10)
|
||
|
: rawValue;
|
||
|
out.push([ a[i], value ]);
|
||
|
}
|
||
|
return out;
|
||
|
}, []);
|
||
|
return this.Object_fromEntries(entries);
|
||
|
},
|
||
|
onIdle(fn, options) {
|
||
|
if ( self.requestIdleCallback ) {
|
||
|
return self.requestIdleCallback(fn, options);
|
||
|
}
|
||
|
return self.requestAnimationFrame(fn);
|
||
|
},
|
||
|
};
|
||
|
scriptletGlobals.safeSelf = safe;
|
||
|
if ( scriptletGlobals.bcSecret === undefined ) { return safe; }
|
||
|
// This is executed only when the logger is opened
|
||
|
const bc = new self.BroadcastChannel(scriptletGlobals.bcSecret);
|
||
|
let bcBuffer = [];
|
||
|
safe.logLevel = scriptletGlobals.logLevel || 1;
|
||
|
safe.sendToLogger = (type, ...args) => {
|
||
|
if ( args.length === 0 ) { return; }
|
||
|
const text = `[${document.location.hostname || document.location.href}]${args.join(' ')}`;
|
||
|
if ( bcBuffer === undefined ) {
|
||
|
return bc.postMessage({ what: 'messageToLogger', type, text });
|
||
|
}
|
||
|
bcBuffer.push({ type, text });
|
||
|
};
|
||
|
bc.onmessage = ev => {
|
||
|
const msg = ev.data;
|
||
|
switch ( msg ) {
|
||
|
case 'iamready!':
|
||
|
if ( bcBuffer === undefined ) { break; }
|
||
|
bcBuffer.forEach(({ type, text }) =>
|
||
|
bc.postMessage({ what: 'messageToLogger', type, text })
|
||
|
);
|
||
|
bcBuffer = undefined;
|
||
|
break;
|
||
|
case 'setScriptletLogLevelToOne':
|
||
|
safe.logLevel = 1;
|
||
|
break;
|
||
|
case 'setScriptletLogLevelToTwo':
|
||
|
safe.logLevel = 2;
|
||
|
break;
|
||
|
}
|
||
|
};
|
||
|
bc.postMessage('areyouready?');
|
||
|
return safe;
|
||
|
}
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
const hnParts = [];
|
||
|
try { hnParts.push(...document.location.hostname.split('.')); }
|
||
|
catch(ex) { }
|
||
|
const hnpartslen = hnParts.length;
|
||
|
if ( hnpartslen === 0 ) { return; }
|
||
|
|
||
|
const todoIndices = new Set();
|
||
|
const tonotdoIndices = [];
|
||
|
|
||
|
// Exceptions
|
||
|
if ( exceptionsMap.size !== 0 ) {
|
||
|
for ( let i = 0; i < hnpartslen; i++ ) {
|
||
|
const hn = hnParts.slice(i).join('.');
|
||
|
const excepted = exceptionsMap.get(hn);
|
||
|
if ( excepted ) { tonotdoIndices.push(...excepted); }
|
||
|
}
|
||
|
exceptionsMap.clear();
|
||
|
}
|
||
|
|
||
|
// Hostname-based
|
||
|
if ( hostnamesMap.size !== 0 ) {
|
||
|
const collectArgIndices = hn => {
|
||
|
let argsIndices = hostnamesMap.get(hn);
|
||
|
if ( argsIndices === undefined ) { return; }
|
||
|
if ( typeof argsIndices === 'number' ) { argsIndices = [ argsIndices ]; }
|
||
|
for ( const argsIndex of argsIndices ) {
|
||
|
if ( tonotdoIndices.includes(argsIndex) ) { continue; }
|
||
|
todoIndices.add(argsIndex);
|
||
|
}
|
||
|
};
|
||
|
for ( let i = 0; i < hnpartslen; i++ ) {
|
||
|
const hn = hnParts.slice(i).join('.');
|
||
|
collectArgIndices(hn);
|
||
|
}
|
||
|
collectArgIndices('*');
|
||
|
hostnamesMap.clear();
|
||
|
}
|
||
|
|
||
|
// Entity-based
|
||
|
if ( entitiesMap.size !== 0 ) {
|
||
|
const n = hnpartslen - 1;
|
||
|
for ( let i = 0; i < n; i++ ) {
|
||
|
for ( let j = n; j > i; j-- ) {
|
||
|
const en = hnParts.slice(i,j).join('.');
|
||
|
let argsIndices = entitiesMap.get(en);
|
||
|
if ( argsIndices === undefined ) { continue; }
|
||
|
if ( typeof argsIndices === 'number' ) { argsIndices = [ argsIndices ]; }
|
||
|
for ( const argsIndex of argsIndices ) {
|
||
|
if ( tonotdoIndices.includes(argsIndex) ) { continue; }
|
||
|
todoIndices.add(argsIndex);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
entitiesMap.clear();
|
||
|
}
|
||
|
|
||
|
// Apply scriplets
|
||
|
for ( const i of todoIndices ) {
|
||
|
try { noSetTimeoutIf(...argsList[i]); }
|
||
|
catch(ex) {}
|
||
|
}
|
||
|
argsList.length = 0;
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
};
|
||
|
// End of code to inject
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
// Inject code
|
||
|
|
||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1736575
|
||
|
// 'MAIN' world not yet supported in Firefox, so we inject the code into
|
||
|
// 'MAIN' ourself when environment in Firefox.
|
||
|
|
||
|
const targetWorld = 'MAIN';
|
||
|
|
||
|
// Not Firefox
|
||
|
if ( typeof wrappedJSObject !== 'object' || targetWorld === 'ISOLATED' ) {
|
||
|
return uBOL_noSetTimeoutIf();
|
||
|
}
|
||
|
|
||
|
// Firefox
|
||
|
{
|
||
|
const page = self.wrappedJSObject;
|
||
|
let script, url;
|
||
|
try {
|
||
|
page.uBOL_noSetTimeoutIf = cloneInto([
|
||
|
[ '(', uBOL_noSetTimeoutIf.toString(), ')();' ],
|
||
|
{ type: 'text/javascript; charset=utf-8' },
|
||
|
], self);
|
||
|
const blob = new page.Blob(...page.uBOL_noSetTimeoutIf);
|
||
|
url = page.URL.createObjectURL(blob);
|
||
|
const doc = page.document;
|
||
|
script = doc.createElement('script');
|
||
|
script.async = false;
|
||
|
script.src = url;
|
||
|
(doc.head || doc.documentElement || doc).append(script);
|
||
|
} catch (ex) {
|
||
|
console.error(ex);
|
||
|
}
|
||
|
if ( url ) {
|
||
|
if ( script ) { script.remove(); }
|
||
|
page.URL.revokeObjectURL(url);
|
||
|
}
|
||
|
delete page.uBOL_noSetTimeoutIf;
|
||
|
}
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
// End of local scope
|
||
|
})();
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
void 0;
|