mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-16 02:00:21 +08:00
354 lines
45 KiB
JavaScript
354 lines
45 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_noEvalIf = function() {
|
||
|
|
||
|
const scriptletGlobals = {}; // jshint ignore: line
|
||
|
|
||
|
const argsList = [["blocker"],["replace"],["ExoLoader"],["/chp_?ad/"],["setInterval"],["tmohentai"],["ads"],["debugger"],["ppu"],["adsBlocked"],["/popunder/i"],["shift"],["adblock"],["/fairAdblock|chp_adblock|adsbygoogle\\.js/"],["ppuQnty"],["adb"],["chp_ad"],["show"],["AdBlock"],["popUnderStage"],["adsbygoogle"],["_0x"],["deblocker"],["popunder"],["/07c225f3\\.online|content-loader\\.com|css-load\\.com|html-load\\.com/"],["interactionCount"],["Popunder"],["String.fromCharCode"],["fairAdblock"],["isFairAdBlocker"],["UserCustomPop"]];
|
||
|
|
||
|
const hostnamesMap = new Map([["audiotools.pro",0],["magesy.blog",0],["magesypro.pro",0],["claimlite.club",0],["orgyxxxhub.com",1],["junkyponk.com",1],["healthfirstweb.com",1],["vocalley.com",1],["yogablogfit.com",1],["howifx.com",1],["en.financerites.com",1],["mythvista.com",1],["livenewsflix.com",1],["cureclues.com",1],["apekite.com",1],["flash-firmware.blogspot.com",1],["uploady.io",1],["taodung.com",1],["mangaesp.co",1],["3movs.com",2],["zegtrends.com",3],["copypastescan.xyz",3],["tainguyenmienphi.com",3],["questloops.com",3],["funkeypagali.com",3],["careersides.com",3],["nayisahara.com",3],["wikifilmia.com",3],["infinityskull.com",3],["viewmyknowledge.com",3],["iisfvirtual.in",3],["starxinvestor.com",3],["acetack.com",3],["blog.carstopia.net",3],["blog.carsmania.net",3],["freshbhojpuri.com",3],["bgmi32bitapk.in",3],["bankshiksha.in",3],["earn.mpscstudyhub.com",3],["earn.quotesopia.com",3],["money.quotesopia.com",3],["best-mobilegames.com",3],["learn.moderngyan.com",3],["bharatsarkarijobalert.com",3],["ikramlar.online",3],["msic.site",3],["fx-22.com",3],["gold-24.net",3],["forexrw7.com",3],["kiemlua.com",3],["link1s.com",3],["bloggingguidance.com",3],["onroid.com",3],["coinsrev.com",3],["10-train.com",3],["110tutorials.com",3],["103.70.114.35",3],["103.74.5.104",3],["185.193.17.214",3],["207hd.com",3],["247beatz.ng",3],["247footballnow.com",3],["27-sidefire-blog.com",3],["2best.club",3],["2the.space",3],["30kaiteki.com",3],["3dyasan.com",3],["3fnews.com",3],["3rabsports.com",3],["4drumkits.com",3],["4fans.gay",3],["4fingermusic.com",3],["4gousya.net",3],["4horlover.com",3],["4spaces.org",3],["519.best",3],["51sec.org",3],["60fps.xyz",3],["80-talet.se",3],["9alami.info",3],["9ketsuki.info",3],["a2zbookmark.com",3],["aboedman.com",3],["addtobucketlist.com",3],["adisann.com",3],["adminreboot.com",3],["adsurfle.com",3],["adsy.pw",3],["advertafrica.net",3],["adnan-tech.com",3],["africue.com",3],["aghasolution.com",3],["aitoolsfree.org",3],["aitohuman.org",3],["aiyumangascanlation.com",3],["alanyapower.com",3],["albania.co.il",3],["albinofamily.com",3],["algodaodocescan.com.br",3],["allcalidad.app",3],["allcelebritywiki.com",3],["allcivilstandard.com",3],["alliptvlinks.com",3],["alliptvs.com",3],["almofed.com",3],["altcryp.com",3],["altselection.com",3],["altyazitube22.lat",3],["amnaymag.com",3],["amritadrino.com",[3,13]],["amtil.com.au",3],["andani.net",3],["androidadult.com",3],["androidfacil.org",3],["angolopsicologia.com",3],["anime4mega.net",3],["anime4mega-descargas.net",3],["anime7.download",3],["anime-torrent.com",3],["animecenterbr.com",3],["animesonlineshd.com",3],["animetwixtor.com",3],["animexin.vip",3],["anmup.com.np",3],["anodee.com",3],["anonyviet.com",3],["anothergraphic.org",3],["aoseugosto.com",3],["aozoraapps.net",3],["apenasmaisumyaoi.com",3],["apkdink.com",3],["apostoliclive.com",3],["appdoze.com",3],["applediagram.com",3],["aprenderquechua.com",3],["arabstd.com",3],["articlebase.pk",3],["articlemela.xyz",3],["articlesmania.me",3],["articlespost.xyz",3],["ascalonscans.com",3],["asiansexdiarys.com",3],["askcerebrum.com",3],["askushowto.com",3],["aspirapolveremigliori.it",3],["astroages.com",3],["astrumscans.xyz",3],["atgstudy.com",3],["atlantisscan.com",3],["atleticalive.it",3],["atozmovies.xyz",3],["audiobookexchangeplace.com",3],["audiotrip.org",3],["auroraconeyisland.xyz",3],["autodime.com",3],["autoindustry.ro",3],["automat.systems",3],["automothink.com",3],["avitter.net",3],["awpd24.com",3],["ayatoon.com",3],["ayuka.link",3],["azamericasat.net",3],["azdly.com",3],["azlyrics.online",3],["azores.co.il",3],["azrom.net",3],["babehubonlyfansly.com",3],["backyardpapa.com",3],["baixedetudo.com.br",3],["balkanteka.net",3],["bandstand.ph",3],["batman.city",3],["bcanepaltu.com",3],["bcanotesnepal.com",3],["bcsnoticias.mx",3],["bdix.app",3],["bdokan.com",3],["bdsomadhan.com",3],["bdstarshop.com",3],["beaddiagrams.com",3],["bearchasingart.com",3],["beatree.cn",3],["bedavahesap.org",3],["beisbolinvernal.com",3],["bengalxpress.in",3],["bestcrack.xyz",3],["bettingexchange.it",3],["bi-girl.net",3],["bibliotecadec
|
||
|
|
||
|
const entitiesMap = new Map([["shrink",1],["24pdd",3],["audiotools",3],["autosport",3],["eventiavversinews",3],["flixhub",3],["freevstplugins",3],["gogetadoslinks",3],["haryanaalert",3],["itdmusic",3],["javboys",3],["keroseed",3],["m4u",3],["magesypro",3],["mcrypto",3],["movies4u",3],["nishankhatri",3],["poplinks",3],["rgmovies",3],["sheikhmovies",3],["userupload",3],["xprime4u",3],["mlwbd",6],["katmoviefix",6],["layardrama21",6],["sdmoviespoint",6],["file-upload",8],["an1me",9],["papafoot",9],["embedme",10],["finfang",10],["hellnaw",10],["moonembed",10],["z12z0vla",10],["fc-lc",14],["azsoft",16],["pasteit",18]]);
|
||
|
|
||
|
const exceptionsMap = new Map([]);
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
function noEvalIf(
|
||
|
needle = ''
|
||
|
) {
|
||
|
if ( typeof needle !== 'string' ) { return; }
|
||
|
const safe = safeSelf();
|
||
|
const logPrefix = safe.makeLogPrefix('noeval-if', needle);
|
||
|
const reNeedle = safe.patternToRegex(needle);
|
||
|
window.eval = new Proxy(window.eval, { // jshint ignore: line
|
||
|
apply: function(target, thisArg, args) {
|
||
|
const a = String(args[0]);
|
||
|
if ( needle !== '' && reNeedle.test(a) ) {
|
||
|
safe.uboLog(logPrefix, 'Prevented:\n', a);
|
||
|
return;
|
||
|
}
|
||
|
if ( needle === '' || safe.logLevel > 1 ) {
|
||
|
safe.uboLog(logPrefix, 'Not prevented:\n', a);
|
||
|
}
|
||
|
return Reflect.apply(target, 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 { noEvalIf(...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_noEvalIf();
|
||
|
}
|
||
|
|
||
|
// Firefox
|
||
|
{
|
||
|
const page = self.wrappedJSObject;
|
||
|
let script, url;
|
||
|
try {
|
||
|
page.uBOL_noEvalIf = cloneInto([
|
||
|
[ '(', uBOL_noEvalIf.toString(), ')();' ],
|
||
|
{ type: 'text/javascript; charset=utf-8' },
|
||
|
], self);
|
||
|
const blob = new page.Blob(...page.uBOL_noEvalIf);
|
||
|
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_noEvalIf;
|
||
|
}
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
// End of local scope
|
||
|
})();
|
||
|
|
||
|
/******************************************************************************/
|
||
|
|
||
|
void 0;
|