Blocks BlockAdblock

Blocks block-adblock

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Blocks BlockAdblock
// @version      1.0
// @namespace    http://tampermonkey.net/
// @description  Blocks block-adblock
// @match        *://**/*
// @grant        none
// @run-at       document-start
// @license      MIT 
// ==/UserScript==

(() => {
    const originalEval = window.eval;
    const keywords = ['advertising', 'ad', 'blocker', 'disabled', 'understand', 'site', 'income', 'okay', 'http://blockadblock.com', ''];

    window.eval = str => {

        // Check for keywords
        const matches = keywords.filter(v => str.includes(v));
        if (matches.length / keywords.length > 0.85) {
            console.log(`[ABBB] Probability of being ad-related: ${(matches.length / keywords.length) * 100}%`);

            // Check if it contains the base64 charset in a variable
            if (str.match(/[A-Za-z]+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'/)) {
                console.log(` >> It contains the base64 charset`);

                // Check if it will clear the body element
                if (str.includes(`document.body.innerHTML=''`)) {
                    console.log(` >> It'll clear your dom. Blocked.`);
                    return;
                }
            }
        }

        return originalEval(str);
    };
})();