mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-16 10:10:20 +08:00
476 lines
115 KiB
JavaScript
476 lines
115 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_abortCurrentScript = function() {
|
||
|
|
||
|
const scriptletGlobals = {}; // jshint ignore: line
|
||
|
|
||
|
const argsList = [["jQuery","cookie"],["showAds"],["open"],["$","_sp_._networkListenerData"],["document.createElement","jsc.mgid.com"],["document.querySelector","popupBlocked"],["Math","/\\}\\s*\\(.*?\\b(self|this|window)\\b.*?\\)/"],["$","undefined"],["JSON.stringify"],["setTimeout","admc"],["Math","XMLHttpRequest"],["$","window.open"],["document.createElement","decodeURIComponent"],["decodeURIComponent","shift"],["$","samInitDetection"],["decodeURI","decodeURIComponent"],["$","lobster"],["$","blockThisUrl"],["String.fromCharCode","shift"],["$","AdBlocker"],["addEventListener","displayMessage"],["document.createElement","admc"],["jQuery","TestAdBlock"],["document.getElementById","document.write"],["document.createElement","/l\\.parentNode\\.insertBefore\\(s/"],["addEventListener","google_ad_client"],["$","test-block"],["$","adi"],["onload","open"],["adcashMacros"],["$","Adblock"],["setTimeout","hommy.mutation.mutation"],["adver"],["ACtMan"],["ExoLoader"],["puShown","/doOpen|popundr/"],["$","serve"],["document.createElement","script"],["$","ltvModal"],["pop3","window.open"],["jQuery","ready"],["setTimeout","1000"],["atob","decodeURIComponent"],["__ADX_URL_U"],["atob","tabunder"],["RegExp","POSTBACK_PIXEL"],["document.getElementById","undefined"],["eval","replace"],["addEventListener","-0x"],["stop","adblock"],["btoa","Adblock"],["atob"],["ab1","ab2"],["jQuery","pp12"],["decodeURI","atob"],["jQuery","btoa"],["btoa","BOOTLOADER_LOADED"],["document.getElementsByTagName","onclick"],["awm","location"],["getCookie"],["__ads"],["setTimeout","____POP"],["is_noadblock","window.location"],["$","AdBlockUtil"],["$","show"],["Math.random","ExoLoader"],["setTimeout","document.querySelector"],["jQuery","document.cookie"],["document.getElementById","adblock"],["btoa"],["$","blockAds"],["setTimeout","manageAntiBlock"],["Object.defineProperty","XMLHttpRequest"],["onload","btoa"],["decodeURI","getScriptFromCss"],["$","onclick"],["document.getElementById","try"],["$","userAgent"],["document.getElementById","adblocker"],["azar","redirect"],["onload"],["$","azar"],["Math.floor","hilltop"],["$","vglnk"],["setTimeout","aadblock"],["$","alertmsg"],["addEventListener","document.createElement"],["readCookieDelit"],["atob","decodeURI"],["Object.defineProperty","trafficjunky"],["$","html"],["__htapop"],["decodeURIComponent","replace"],["parseInt","open"],["jQuery","Adblocker"],["blur"],["document.createElement","onerror"],["$","open"],["document.getElementById","AdBlock"],["document.getElementById","testadblock"],["document.addEventListener","google_ad_client"],["setTimeout","isIframeNetworking"],["Math.floor","axtd"],["document.getElementById","overlayBtn"],["document.getElementById","ads"],["$","adb"],["String.fromCharCode","decodeURIComponent"],["Object.defineProperty","document.body.appendChild"],["$","adblockDetected"],["Object.assign","popunder"],["document.getElementById","ad_block"],["jQuery","AdBlock"],["setTimeout","iframeTestTimeMS"],["setTimeout","runInIframe"],["Math.floor","iframeTestTimeMS"],["Math","='\\x"],["jQuery","dismissAdBlock"],["crakPopInParams"],["onload","onclick"],["document.getElementById","banner"],["document.getElementById","blocker_div"],["document.getElementById","onscroll"],["$","#DontBloxMyAdZ"],["$","#pageWrapper"],["$","banner"],["document.getElementById","adpbtest"],["document.getElementById","alert"],["JSON.parse","showTrkURL"],["Math","/window\\['(?:\\\\x\\d{2}){1}/"],["addEventListener","nextFunction"],["document.createElement","Adblock"],["$","adblock"],["$","gandalfads"],["document.createElement","Tool"],["String.fromCharCode","atob"],["document.getElementsByTagName","script"],["$","String.fromCharCode"],["JSON.parse","atob"],["String.prototype.charCodeAt","tabunder"],["$","adBlockChecker"],["$","urlForPopup"],["document.addEventListener","click"],["document.getElementById","overlay"],["setInterval","location"],["Math.floor","vpn"],["adBlockDetected"],["$",".height"],["document.documentElement","break;case $."],["RegExp","0x"],["Math.random","banner"],["spr"],["document.oncontextmenu"],["document.onmousedow
|
||
|
|
||
|
const hostnamesMap = new Map([["motherless.com",0],["golem.de",1],["skidrowreloaded.com",2],["faz.net",3],["vidia.tv",7],["pakkotoisto.com",7],["ignboards.com",8],["cricplay2.xyz",[9,343]],["atomtt.com",9],["nolive.me",[9,147,352]],["worldcupstream.pm",[9,273]],["livesport24.net",[9,345]],["1l1l.to",9],["cdn1.link",9],["vikistream.com",[9,147,344]],["subtitles.cam",9],["trustexploration.com",9],["nflstreams.me",[9,147,273]],["moviesonlinefree.net",[9,148]],["futemax.app",[9,344]],["bestsolaris.com",9],["unbiasedsenseevent.com",9],["weakstream.org",9],["mcloud.bz",10],["iir.ai",10],["deseneledublate.com",10],["01fmovies.com",[10,342]],["123moviesfun.is",10],["dailyuploads.net",11],["nitroflare.com",[11,39]],["filerice.com",11],["10fastfingers.com",12],["androidrepublic.org",14],["cpmlink.net",15],["turbobit.net",15],["xrares.com",15],["footballstream.tv",15],["mlbstream.tv",15],["nbastream.tv",15],["nflstream.tv",15],["bdsmporn.cc",[15,274]],["cocoporn.net",15],["dirtyporn.cc",[15,274]],["faperplace.com",[15,274]],["freeadultvideos.cc",[15,274]],["freepornstream.cc",15],["generalpornmovies.com",[15,274]],["kinkyporn.cc",[15,274]],["moviesxxx.cc",[15,274]],["movstube.net",15],["onlinefetishporn.cc",[15,274]],["peetube.cc",[15,274]],["pornonline.cc",[15,274]],["porntube18.cc",[15,274]],["streamextreme.cc",[15,274]],["streamporn.cc",[15,274]],["videoxxx.cc",[15,274]],["watchporn.cc",[15,274]],["x24.video",[15,274]],["xxxonline.cc",[15,274]],["xxxonlinefree.com",15],["xxxopenload.com",[15,274]],["gonzoporn.cc",[15,274]],["onlinexxx.cc",[15,274]],["tvporn.cc",[15,274]],["0xxx.ws",15],["multiup.io",15],["multiup.org",15],["multiup.eu",15],["nudogram.com",15],["freesoftpdfdownload.blogspot.com",15],["files.im",[15,344]],["d0o0d.com",[15,147]],["do0od.com",[15,147]],["ds2video.com",[15,147]],["shorterall.com",[15,344]],["spankbang.cc",15],["spank-and-bang.com",15],["javbel.com",15],["ekasiwap.com",15],["pornbox.cc",[15,274]],["sturls.com",15],["alluretube.com",15],["anyxvideos.com",15],["fetishtube.cc",15],["fucktheporn.com",15],["italianporn.com.es",15],["japanporn.tv",[15,387]],["javsub.buzz",15],["lovefap.com",15],["mommysucks.com",15],["mzansinudes.com",15],["napiszar.com",[15,274]],["of-model.com",15],["onlineporn24.com",[15,274]],["onlyfansleaks.tv",15],["porntube15.com",15],["pornvdoxxx.com",15],["sexavgo.com",15],["store-of-beats.ru",15],["vlxxs.net",15],["hispasexy.org",15],["acervodaputaria.com.br",15],["mmopeon.ru",15],["mangaraw.org",15],["uporn.icu",[15,274]],["sexgayplus.com",15],["archivebate.com",[15,274]],["wetter.com",16],["business-standard.com",17],["audioz.download",18],["peeplink.in",18],["mexa.sh",18],["gaybeeg.info",18],["urlpay.net",18],["javtiful.com",[18,48,260]],["kropic.com",[18,274]],["ricettafitness.com",18],["legendaoficial.net",18],["yourporngod.com",18],["freeomovie.to",[18,274]],["xxxmax.net",18],["imagenesderopaparaperros.com",[18,345]],["xxvideoss.org",18],["zonebourse.com",19],["aofsoru.com",20],["olacast.live",21],["imgdrive.net",[22,23]],["imgwallet.com",[22,23]],["imgadult.com",23],["imgtaxi.com",23],["imgdawgknuttz.com",[24,343]],["leechall.com",24],["jpopsingles.eu",[24,147]],["kfapfakes.com",24],["xmegadrive.com",24],["simply-hentai.com",[24,274]],["onlinepornhub.net",24],["nepaliputi.net",24],["yifysubtitles.vip",24],["10convert.com",24],["besthdgayporn.com",[24,274]],["bigojav.com",24],["drivenime.com",24],["fucksporn.com",24],["fullxcinema1.com",24],["gigmature.com",24],["homemoviestube.com",[24,503]],["javchill.com",24],["javup.org",24],["kisscos.net",[24,48]],["kmansin09.com",24],["leermanga.net",24],["mangamovil.net",24],["naijauncut.com",24],["nudeslegion.com",24],["porn00.org",[24,274]],["pornohubonline.com",24],["pornxp.com",[24,274]],["readwebtoononline.net",24],["shemaleup.net",24],["tatli.biz",24],["teenager365.com",[24,252]],["javenspanish.com",[24,274]],["adslink.pw",[24,147,274]],["porhubvideo.com",[24,47]],["pornktubes.net",[24,47]],["hentaitube1.lol",[24,274]],["magesy.download",25],["okulsoru.com",25],["onlinetutorium.com",25],["aiimgvlog.fun",[25,47]],["sakaiplus.com
|
||
|
|
||
|
const entitiesMap = new Map([["watchcartoononline",[4,147]],["watchcartoonsonline",4],["wcostream",4],["transfermarkt",[5,6]],["mma-core",7],["123link",[7,26,27]],["torlock",9],["torlock2",9],["tennisstreams",[9,273,343,344,345]],["vipleague",[9,147,352]],["strikeout",[9,18,344]],["viprow",9],["atomohd",[9,344]],["topstreams",[9,209]],["x1337x",9],["streamadblocker",[9,147]],["buffstreams",[9,147,273,372]],["pogolinks",9],["1stream",[9,37,147]],["yts-subs",9],["poscitech",[9,344]],["unblockit",9],["f1livegp",9],["sportsembed",9],["sportsonline",[9,451]],["daddylivehd",[9,147]],["tutelehd",9],["watchtvchh",9],["liveon",9],["watch-series",10],["watchseries",[10,147]],["limetorrents",[10,109]],["vidcloud",[10,42]],["moviflex",10],["bmovies",[10,343]],["bolly4umovies",10],["putlocker",[10,147,342,344]],["movie123",10],["oxy",[11,479]],["mylink",[13,343]],["my1ink",[13,343]],["myl1nk",[13,343]],["myli3k",[13,343]],["biqle",15],["sxyprn",[15,24,274]],["grantorrent",[15,73]],["grantorrent1",15],["inkapelis",[15,84]],["loveroms",15],["ver-pelis",15],["torrentz2eu",[15,97]],["dfiles",15],["dood",[15,147]],["13377x",15],["streamingcommunity",15],["sexdiaryz",[15,24]],["animepahe",[18,343]],["kwik",[18,342]],["seehd",18],["tamilyogi",18],["hpaudiobooks",18],["yts",[21,344]],["gogoanime",[24,42]],["hdfull",24],["weloma",24],["moviesjoy",[24,147]],["moviegan",24],["anoboy",25],["kinos",29],["kinox",29],["torrentdownload",[29,265]],["torrentdownloads",29],["proxybit",29],["123unblock",[29,42]],["txxx",31],["voyeurhit",32],["upornia",32],["hotmovs",32],["thegay",32],["hdzog",32],["perfectgirls",[34,274]],["perfektdamen",34],["absoluporn",34],["khatrimaza",35],["mangovideo",37],["sound-park",[37,97]],["soundpark",[37,97]],["soundpark-club",[37,97]],["gdtot",[37,147]],["latesthdmovies",[37,47]],["adsrt",42],["a2zapk",[42,85]],["myvidmate",42],["voirfilms",42],["tamilmv",42],["streamingworld",[42,345]],["2umovies",42],["nekopoi",44],["file-upload",[46,147,266]],["dutchycorp",47],["nsw2u",47],["world4ufree",[47,344]],["dewimg",48],["imgtown",48],["imgviu",48],["mazpic",48],["outletpic",48],["picrok",48],["hideout",49],["stream2watch",[51,345]],["animeflv",[53,147]],["hyperdebrid",54],["divxtotal",55],["divxtotal1",55],["pelisplus2",57],["desiupload",59],["douploads",64],["vipracing",64],["bg-gledai",68],["okhatrimaza",72],["ddlvalley",74],["mangaku",75],["camwhores",80],["camwhorestv",80],["cambabe",[80,117]],["uploadbaz",[80,297]],["redtube",89],["pornhub",89],["filecrypt",[92,93,147]],["peliculas24",95],["descargasok",100],["pirateproxy",[106,107]],["file4go",110],["milfnut",118],["embedme",[127,147,269]],["finfang",[127,147,269]],["hellnaw",[127,147,269]],["moonembed",[127,147,269]],["z12z0vla",[127,147,269]],["gamecopyworld",133],["dailysport",134],["mixdrop",136],["mixdrp",136],["l23movies",137],["123moviess",137],["123movieshub",[137,147]],["estrenosflux",137],["moretvtime",145],["0123movie",147],["11xmovies",147],["123chill",147],["123mkv",147],["123movies-free",147],["123movies-org",147],["123movies",147],["123moviesfree",[147,344]],["123movieweb",147],["1direct-cloud",147],["1todaypk",147],["2kmovie",147],["3kmovies",147],["4movierulz",147],["4movierulz1",147],["5movies",147],["720pflix",147],["7moviesrulz",147],["7starhd",[147,306]],["9kmovies",[147,344]],["9xflix",147],["a8ix",147],["adblocktape",147],["ak4eg",[147,484]],["animeunity",147],["animixplay",147],["aniwatch",147],["arbsd",147],["asianhdplay",147],["atishmkv",147],["bdmusic28",147],["bolly2tolly",147],["clickndownload",147],["couchtuner",[147,148]],["daddylive1",147],["direct-cloud",147],["dlhd",147],["dooood",147],["downloadhub",147],["egybest",147],["embedplayer",147],["embtaku",147],["emovies",147],["esportivos",147],["faselhd-watch",147],["faselhd",147],["faselhdwatch",147],["filemooon",147],["filmy-hit",147],["filmygod",147],["flixhq",147],["fmoonembed",147],["fmoviesfree",147],["freemovies",147],["gdflix",147],["gogohd",147],["gokutv",147],["gomovies",147],["hdfriday",147],["hdhub4u",147],["hdmoviehub",147],["hdmovies23",147],["hianime",147],["hollymoviehd",147
|
||
|
|
||
|
const exceptionsMap = new Map([]);
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
function abortCurrentScript(...args) {
|
||
|
runAtHtmlElementFn(( ) => {
|
||
|
abortCurrentScriptCore(...args);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function abortCurrentScriptCore(
|
||
|
target = '',
|
||
|
needle = '',
|
||
|
context = ''
|
||
|
) {
|
||
|
if ( typeof target !== 'string' ) { return; }
|
||
|
if ( target === '' ) { return; }
|
||
|
const safe = safeSelf();
|
||
|
const logPrefix = safe.makeLogPrefix('abort-current-script', target, needle, context);
|
||
|
const reNeedle = safe.patternToRegex(needle);
|
||
|
const reContext = safe.patternToRegex(context);
|
||
|
const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
|
||
|
const thisScript = document.currentScript;
|
||
|
const chain = target.split('.');
|
||
|
let owner = window;
|
||
|
let prop;
|
||
|
for (;;) {
|
||
|
prop = chain.shift();
|
||
|
if ( chain.length === 0 ) { break; }
|
||
|
if ( prop in owner === false ) { break; }
|
||
|
owner = owner[prop];
|
||
|
if ( owner instanceof Object === false ) { return; }
|
||
|
}
|
||
|
let value;
|
||
|
let desc = Object.getOwnPropertyDescriptor(owner, prop);
|
||
|
if (
|
||
|
desc instanceof Object === false ||
|
||
|
desc.get instanceof Function === false
|
||
|
) {
|
||
|
value = owner[prop];
|
||
|
desc = undefined;
|
||
|
}
|
||
|
const debug = shouldDebug(extraArgs);
|
||
|
const exceptionToken = getExceptionToken();
|
||
|
const scriptTexts = new WeakMap();
|
||
|
const getScriptText = elem => {
|
||
|
let text = elem.textContent;
|
||
|
if ( text.trim() !== '' ) { return text; }
|
||
|
if ( scriptTexts.has(elem) ) { return scriptTexts.get(elem); }
|
||
|
const [ , mime, content ] =
|
||
|
/^data:([^,]*),(.+)$/.exec(elem.src.trim()) ||
|
||
|
[ '', '', '' ];
|
||
|
try {
|
||
|
switch ( true ) {
|
||
|
case mime.endsWith(';base64'):
|
||
|
text = self.atob(content);
|
||
|
break;
|
||
|
default:
|
||
|
text = self.decodeURIComponent(content);
|
||
|
break;
|
||
|
}
|
||
|
} catch(ex) {
|
||
|
}
|
||
|
scriptTexts.set(elem, text);
|
||
|
return text;
|
||
|
};
|
||
|
const validate = ( ) => {
|
||
|
const e = document.currentScript;
|
||
|
if ( e instanceof HTMLScriptElement === false ) { return; }
|
||
|
if ( e === thisScript ) { return; }
|
||
|
if ( context !== '' && reContext.test(e.src) === false ) {
|
||
|
// eslint-disable-next-line no-debugger
|
||
|
if ( debug === 'nomatch' || debug === 'all' ) { debugger; }
|
||
|
return;
|
||
|
}
|
||
|
if ( safe.logLevel > 1 && context !== '' ) {
|
||
|
safe.uboLog(logPrefix, `Matched src\n${e.src}`);
|
||
|
}
|
||
|
const scriptText = getScriptText(e);
|
||
|
if ( reNeedle.test(scriptText) === false ) {
|
||
|
// eslint-disable-next-line no-debugger
|
||
|
if ( debug === 'nomatch' || debug === 'all' ) { debugger; }
|
||
|
return;
|
||
|
}
|
||
|
if ( safe.logLevel > 1 ) {
|
||
|
safe.uboLog(logPrefix, `Matched text\n${scriptText}`);
|
||
|
}
|
||
|
// eslint-disable-next-line no-debugger
|
||
|
if ( debug === 'match' || debug === 'all' ) { debugger; }
|
||
|
safe.uboLog(logPrefix, 'Aborted');
|
||
|
throw new ReferenceError(exceptionToken);
|
||
|
};
|
||
|
// eslint-disable-next-line no-debugger
|
||
|
if ( debug === 'install' ) { debugger; }
|
||
|
try {
|
||
|
Object.defineProperty(owner, prop, {
|
||
|
get: function() {
|
||
|
validate();
|
||
|
return desc instanceof Object
|
||
|
? desc.get.call(owner)
|
||
|
: value;
|
||
|
},
|
||
|
set: function(a) {
|
||
|
validate();
|
||
|
if ( desc instanceof Object ) {
|
||
|
desc.set.call(owner, a);
|
||
|
} else {
|
||
|
value = a;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
} catch(ex) {
|
||
|
safe.uboErr(logPrefix, `Error: ${ex}`);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function runAtHtmlElementFn(fn) {
|
||
|
if ( document.documentElement ) {
|
||
|
fn();
|
||
|
return;
|
||
|
}
|
||
|
const observer = new MutationObserver(( ) => {
|
||
|
observer.disconnect();
|
||
|
fn();
|
||
|
});
|
||
|
observer.observe(document, { childList: true });
|
||
|
}
|
||
|
|
||
|
function getExceptionToken() {
|
||
|
const safe = safeSelf();
|
||
|
const token =
|
||
|
String.fromCharCode(Date.now() % 26 + 97) +
|
||
|
safe.Math_floor(safe.Math_random() * 982451653 + 982451653).toString(36);
|
||
|
const oe = self.onerror;
|
||
|
self.onerror = function(msg, ...args) {
|
||
|
if ( typeof msg === 'string' && msg.includes(token) ) { return true; }
|
||
|
if ( oe instanceof Function ) {
|
||
|
return oe.call(this, msg, ...args);
|
||
|
}
|
||
|
}.bind();
|
||
|
return token;
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
function shouldDebug(details) {
|
||
|
if ( details instanceof Object === false ) { return false; }
|
||
|
return scriptletGlobals.canDebug && details.debug;
|
||
|
}
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
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 { abortCurrentScript(...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_abortCurrentScript();
|
||
|
}
|
||
|
|
||
|
// Firefox
|
||
|
{
|
||
|
const page = self.wrappedJSObject;
|
||
|
let script, url;
|
||
|
try {
|
||
|
page.uBOL_abortCurrentScript = cloneInto([
|
||
|
[ '(', uBOL_abortCurrentScript.toString(), ')();' ],
|
||
|
{ type: 'text/javascript; charset=utf-8' },
|
||
|
], self);
|
||
|
const blob = new page.Blob(...page.uBOL_abortCurrentScript);
|
||
|
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_abortCurrentScript;
|
||
|
}
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
// End of local scope
|
||
|
})();
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
void 0;
|