diff --git a/src/bypasses/letsboost.js b/src/bypasses/letsboost.js index 02b37491..bb5ad513 100644 --- a/src/bypasses/letsboost.js +++ b/src/bypasses/letsboost.js @@ -19,7 +19,6 @@ export default class Letsboost extends BypassDefinition { }); } - } export const matches = ['letsboost.net']; \ No newline at end of file diff --git a/src/helpers/detectadblock.js b/src/helpers/detectadblock.js index c1270bcd..d9cf3511 100644 --- a/src/helpers/detectadblock.js +++ b/src/helpers/detectadblock.js @@ -1,54 +1,5 @@ export function detectAdblock() { - const adblockTests = { - // https://github.com/uBlockOrigin/uAssets/blob/master/filters/filters-2022.txt - uBlockOrigin: { - url: 'https://incolumitas.com/data/yzfdmoan.js', - id: '837jlaBksSjd9jh', - }, - // https://github.com/easylist/easylist/blob/master/easylist/easylist_general_block.txt - adblockPlus: { - url: 'https://incolumitas.com/data/utep_ad.js', - id: 'hfuBadsf3hFAk', - }, - }; - - function canLoadRemoteScript(obj) { - return new Promise(function (resolve, reject) { - var script = document.createElement('script'); - - script.onload = function () { - if (document.getElementById(obj.id)) { - resolve(false); - } else { - resolve(true); - } - } - - script.onerror = function () { - resolve(true); - } - - script.src = obj.url; - document.body.appendChild(script); - }); - } - - return new Promise(function (resolve, reject) { - let promises = [ - canLoadRemoteScript(adblockTests.uBlockOrigin), - canLoadRemoteScript(adblockTests.adblockPlus), - ]; - - Promise.all(promises).then((results) => { - resolve({ - uBlockOrigin: results[0], - adblockPlus: results[1], - usingAdblock: (results[0] === true) || (results[1] === true), - }); - }).catch((err) => { - reject(err); - }); - }); - } + const e = { uBlockOrigin: { url: "https://example.org/data/yzfdmoan.js", id: "837jlaBksSjd9jh" }, adblockPlus: { url: "https://example.org/data/utep_ad.js", id: "hfuBadsf3hFAk" } }; function c(e) { return new Promise(function (n, o) { var t = document.createElement("script"); t.onload = function () { document.getElementById(e.id) ? n(!1) : n(!0) }, t.onerror = function () { n(!0) }, t.src = e.url, document.body.appendChild(t) }) } return new Promise(function (o, t) { var n = [c(e.uBlockOrigin), c(e.adblockPlus)]; Promise.all(n).then(n => { o({ uBlockOrigin: n[0], adblockPlus: n[1], usingAdblock: !0 === n[0] || !0 === n[1] }) }).catch(n => { t(n) }) }) +} - export default detectAdblock; \ No newline at end of file +export default detectAdblock; \ No newline at end of file