mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-16 02:00:21 +08:00
360 lines
18 KiB
JavaScript
360 lines
18 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_adjustSetTimeout = function() {
|
|
|
|
const scriptletGlobals = {}; // jshint ignore: line
|
|
|
|
const argsList = [["","10000"],["_0x","*"],["grecaptcha.ready","*"],["redirect","4000"],[],["dlw","40000"],["seconds"],["ez","*","0.02"],["/.?/","4000"],["run"],["disabled"],["","","0"],["tick"],["","","0.02"],["CountBack","990"],["notification_state","12000"],["/SplashScreen|BannerAd/"],["countdown","1000","0.02"],["/.?/","","0.02"],["contador","*","0.001"],["","10000","0"],["startDownload","8000"],["0x","*"],["countdown","*"],["download","1000","0.001"],["count"],["getElementById","*"],["downloadBtn","*"],["getlink","*","0.001"],["gotoo","*"],["value","*"],["/\\$\\('|ai-close/","*","0.001"],["div_form"],["","*","0.1"],["shortenbl"],["enbll"],["","1000"],["getElementById","*","0.001"],["downloadbtn"],["counter"],["readyToVote","12000"],["","7000","0"],["download","1100"],["countDown"],["countdown","10000"],["animation"],[".fadeIn()","3000"],["load_ads"],["_0x","15000"],["location.href","8000"],["aTagChange","12000"],["window.location.href","*"],["isScrexed","5000"],["() => n(t)","*"],["/__ez|window.location.href/","*"],["adFreePopup","15000","0.02"],["countdown"],["remaining","1000","0.001"],["show","4000"],["download_loading","*"],["submit","5000"],["fa-unlock","3000"],["setinteracted","2000"],["waiting","5000"],["[native code]","5000"],["adBlockerCountdown","*","0.02"],["shortConfig","15000"],["redirectpage","13500","0.001"],["countdown","","0.02"],["decodeURL","*"],["(!1)","*"],["bFired","*"],["setC"],["-1","*","0.001"],["total","1000","0.001"],["countdown","*","0.001"],["tick","1000","0.001"],["/outboundLink/"],["isPeriodic","*"],["/EzoIvent|TDELAY/","5000"],["b()","3000"],["ads","*"],["readyPromise","5000","0.001"],["taboola timeout","*","0.001"],["clearInterval(run)","5000","0.001"],["/TDELAY|EzoIvent/","*","0.001"],["[native code]","17000","0.001"]];
|
|
|
|
const hostnamesMap = new Map([["spiele.bild.de",0],["gamefront.com",0],["moviepilot.de",1],["imgadult.com",3],["imgdrive.net",3],["imgtaxi.com",3],["imgwallet.com",3],["techmyntra.net",4],["globalbesthosting.com",4],["srt.am",4],["themeslide.com",4],["hubfiles.ws",4],["ausfile.com",4],["siriusfiles.com",4],["juegoviejo.com",4],["4share.vn",4],["lnk2.cc",4],["modagamers.com",4],["katfile.com",4],["sofwaremania.blogspot.com",4],["memoriadatv.com",4],["dosya.co",4],["clipartmax.com",4],["jptorrent.org",4],["quizlet.com",4],["sourceforge.net",4],["redload.co",4],["juegos.eleconomista.es",4],["1fichier.com",5],["indi-share.com",6],["megaupto.com",6],["onuploads.com",6],["playretrogames.com",7],["gsm1x.xyz",9],["top1iq.com",9],["youku.com",11],["acessarlink.online",11],["subdowns.com",11],["files.im",12],["dokumen.tips",13],["file.magiclen.org",13],["so1.asia",13],["streamvid.net",13],["lewdzone.com",14],["direct-link.net",15],["link-to.net",15],["gamearter.com",16],["dvdgayonline.com",17],["tudogamesbr.com",18],["investnewsbrazil.com",19],["subsvip.com",20],["updown.link",21],["thehouseofportable.com",22],["an1.com",23],["voltupload.com",24],["pimpandhost.com",25],["moonplusnews.com",26],["loanoffering.in",26],["enit.in",27],["junkyponk.com",28],["healthfirstweb.com",28],["vocalley.com",28],["yogablogfit.com",28],["howifx.com",28],["en.financerites.com",28],["mythvista.com",28],["livenewsflix.com",28],["cureclues.com",28],["apekite.com",28],["hipsonyc.com",29],["theforyou.in",29],["gyanitheme.com",29],["hostadviser.net",29],["fansonlinehub.com",30],["hotmediahub.com",30],["terabox.fun",30],["teralink.me",30],["terashare.me",30],["teraearn.com",30],["rawlazy.si",31],["appsbull.com",32],["diudemy.com",32],["maqal360.com",32],["intercelestial.com",33],["takez.co",[34,35]],["webzeni.com",36],["msic.site",37],["fx-22.com",37],["gold-24.net",37],["forexrw7.com",37],["uploadking.net",38],["gettapeads.com",39],["streamnoads.com",39],["tapeadsenjoyer.com",39],["tapeadvertisement.com",39],["tapeantiads.com",39],["tapeblocker.com",39],["tapelovesads.org",39],["tapenoads.com",39],["tapewithadblock.org",39],["top.gg",40],["emulatorgames.net",41],["actionviewphotography.com",42],["exporntoons.net",42],["mat6tube.com",42],["noodlemagazine.com",42],["tyler-brown.com",42],["ukdevilz.com",42],["aapks.com",43],["mcrypto.club",44],["codingnepalweb.com",45],["maxstream.video",46],["maxlinks.online",46],["embed.nana2play.com",47],["mgnet.xyz",48],["1bitspace.com",49],["ytsubme.com",50],["thecustomrom.com",51],["quizack.com",52],["media.cms.nova.cz",53],["yhocdata.com",54],["surfline.com",55],["downloadr.in",56],["downloadudemy.com",56],["xubster.com",57],["uploadcloud.pro",58],["romsgames.net",60],["romsget.io",60],["sub1s.com",61],["mboost.me",62],["bloggertheme.xyz",63],["atresplayer.com",64],["redketchup.io",65],["dktechnicalmate.com",67],["indiakablog.com",67],["recipahi.com",67],["20sfvn.com",68],["hi888.today",68],["oto5s.com",68],["w88.limo",68],["tralhasvarias.blogspot.com",69],["thestar.com",71],["present.rssing.com",72],["infidrive.net",73],["sethphat.com",74],["theapkfolder.com",75],["dfast.app",75],["upapk.io",76],["cyclingnews.com",77],["watcho.com",78],["neurotray.com",79],["theonion.com",[80,81]],["20min.ch",82],["13tv.co.il",[83,84]],["tierlists.com",85],["www.youtube.com",86]]);
|
|
|
|
const entitiesMap = new Map([["slreamplay",2],["pouvideo",2],["povvideo",2],["povw1deo",2],["povwideo",2],["powv1deo",2],["powvibeo",2],["powvideo",2],["powvldeo",2],["bdupload",4],["desiupload",4],["9xupload",4],["grantorrent",4],["grantorrents",4],["hdfull",4],["pelispedia",4],["uptomega",6],["imgrock",8],["mixdrop",10],["mixdrp",10],["zeefiles",12],["financerites",27],["adblockeronstape",39],["adblockplustape",39],["adblocktape",39],["antiadtape",39],["noblocktape",39],["shavetape",39],["stapadblockuser",39],["strcloud",39],["streamadblockplus",39],["streamta",39],["streamtape",39],["streamtapeadblockuser",39],["strtape",39],["strtapeadblock",39],["adblockeronstreamtape",39],["apkmody",59],["writedroid",66],["empire-stream",70],["empire-streaming",70],["empire-streamz",70]]);
|
|
|
|
const exceptionsMap = new Map([]);
|
|
|
|
/******************************************************************************/
|
|
|
|
function adjustSetTimeout(
|
|
needleArg = '',
|
|
delayArg = '',
|
|
boostArg = ''
|
|
) {
|
|
if ( typeof needleArg !== 'string' ) { return; }
|
|
const safe = safeSelf();
|
|
const reNeedle = safe.patternToRegex(needleArg);
|
|
let delay = delayArg !== '*' ? parseInt(delayArg, 10) : -1;
|
|
if ( isNaN(delay) || isFinite(delay) === false ) { delay = 1000; }
|
|
let boost = parseFloat(boostArg);
|
|
boost = isNaN(boost) === false && isFinite(boost)
|
|
? Math.min(Math.max(boost, 0.001), 50)
|
|
: 0.05;
|
|
self.setTimeout = new Proxy(self.setTimeout, {
|
|
apply: function(target, thisArg, args) {
|
|
const [ a, b ] = args;
|
|
if (
|
|
(delay === -1 || b === delay) &&
|
|
reNeedle.test(a.toString())
|
|
) {
|
|
args[1] = b * boost;
|
|
}
|
|
return target.apply(thisArg, args);
|
|
}
|
|
});
|
|
}
|
|
|
|
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 { adjustSetTimeout(...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_adjustSetTimeout();
|
|
}
|
|
|
|
// Firefox
|
|
{
|
|
const page = self.wrappedJSObject;
|
|
let script, url;
|
|
try {
|
|
page.uBOL_adjustSetTimeout = cloneInto([
|
|
[ '(', uBOL_adjustSetTimeout.toString(), ')();' ],
|
|
{ type: 'text/javascript; charset=utf-8' },
|
|
], self);
|
|
const blob = new page.Blob(...page.uBOL_adjustSetTimeout);
|
|
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_adjustSetTimeout;
|
|
}
|
|
|
|
/******************************************************************************/
|
|
|
|
// End of local scope
|
|
})();
|
|
|
|
/******************************************************************************/
|
|
|
|
void 0;
|