Universal AdBlock Bypass (Beta) (Optimized)

Advanced bypass for ad-blocker detection with filter list optimization

目前為 2025-05-03 提交的版本,檢視 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Universal AdBlock Bypass (Beta) (Optimized)
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Advanced bypass for ad-blocker detection with filter list optimization
// @author       Snow2122
// @license      MIT
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Counter common ad-blocker detection variables
    const spoofedVars = {
        'ai_adb_active': true,
        'ai_adb_action': 0,
        'adblock': false,
        'adsBlocked': false,
        'canRunAds': true,
        'showAds': true
    };

    Object.keys(spoofedVars).forEach(key => {
        Object.defineProperty(window, key, {
            value: spoofedVars[key],
            writable: false,
            configurable: false
        });
    });

    // Mock ad-blocker detection functions
    window.ai_adb_undetected = function() {
        document.body?.setAttribute('data-data-mask', 'clear');
        if (typeof window.ai_adb_undetected_actions === 'function') {
            window.ai_adb_undetected_actions(0);
        }
    };

    // Spoof bait content visibility
    function spoofBaitElements() {
        const baitSelectors = [
            '.ads-ad', '.ad-banner', '.ad-block', '[class*="ad-"]', '[id*="ad-"]',
            '.banner-ad', '.adsbygoogle', '.detectadblock', '[class*="banner"]',
            // From Fanboy Annoyance and Social lists
            '.cookie-notice', '.gdpr-consent', '.social-share', '[class*="cookie-"]',
            '[id*="social-"]', '.popup-overlay', '.newsletter-popup'
        ];
        baitSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => {
                el.style.display = 'block';
                el.style.visibility = 'visible';
                el.style.height = 'auto';
                el.style.width = 'auto';
                el.style.opacity = '1';
                el.removeAttribute('hidden');
            });
        });
    }

    // Intercept and spoof fetch requests for ad-related resources
    const adDomains = [
        'pagead', 'ads.', 'doubleclick', 'adsbygoogle', 'ad-', 'banner',
        // From EasyList
        'googlesyndication', 'adnxs', 'pubmatic', 'openx', 'rubiconproject',
        'criteo', 'adform', 'yieldmanager', 'smartadserver', 'adtech'
    ];
    const adDomainRegex = new RegExp(`(${adDomains.join('|')})`, 'i');

    const originalFetch = window.fetch;
    window.fetch = function(url, options) {
        if (adDomainRegex.test(url)) {
            return Promise.resolve(new Response('OK', { status: 200, statusText: 'OK' }));
        }
        return originalFetch.apply(this, arguments);
    };

    // Intercept XMLHttpRequest for ad-related resources
    const originalOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function(method, url) {
        if (adDomainRegex.test(url)) {
            this._isAdRequest = true;
            return;
        }
        return originalOpen.apply(this, arguments);
    };

    const originalSend = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send = function() {
        if (this._isAdRequest) {
            this.dispatchEvent(new Event('load'));
            return;
        }
        return originalSend.apply(this, arguments);
    };

    // Remove ad-blocker overlays and messages
    function removeAdBlockElements() {
        const selectors = [
            'ins > div', '.ad-block-message', '#adblock-overlay', '.ai-adb-overlay',
            '.adblock-notice', '.ai-adb-message-window', '[class*="adblock-"]',
            '[id*="adblock-"]', '.ads-blocker-warning', '.disable-adblock',
            // From EasyList and Fanboy Annoyance
            '.popup-ad', '.interstitial-ad', '.video-ad', '[class*="sponsored-"]',
            '.cookie-consent', '.privacy-notice', '[id*="gdpr-"]', '.social-widget'
        ].join(', ');
        document.querySelectorAll(selectors).forEach(el => el.remove());
    }

    // Clear ad-blocker and tracking-related cookies
    function clearCookies() {
        const cookies = [
            'aiADB', 'aiADB_PV', 'aiADB_PR', 'adblock_detected',
            'adblock', 'ads_blocked', 'adb_detected',
            // From Fanboy CookieMonster and EasyPrivacy
            '__utma', '__utmb', '__utmz', '_ga', '_gid', '_gat',
            'CONSENT', 'cookie_notice_accepted', 'eu_cookie'
        ];
        cookies.forEach(cookie => {
            document.cookie = `${cookie}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
        });
    }

    // Restore hidden content and counter anti-adblock classes
    function restoreContent() {
        const hiddenSelectors = [
            '.ai-adb-hide', '.adblock-hidden', '[class*="hidden-by-adblock"]',
            // From EasyList
            '[class*="blocked-ad"]', '[style*="display: none"]'
        ];
        const showSelectors = [
            '.ai-adb-show', '.adblock-show', '[class*="show-if-adblock"]',
            // From Fanboy Annoyance
            '[class*="consent-"]', '[class*="popup-"]'
        ];

        hiddenSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => {
                el.style.display = 'block';
                el.style.visibility = 'visible';
                el.style.opacity = '1';
                el.classList.remove(...el.classList.values());
            });
        });

        showSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => {
                el.style.display = 'none';
                el.classList.remove(...el.classList.values());
            });
        });
    }

    // Neutralize IAB detection scripts
    function neutralizeIABDetection() {
        const iabBait = document.querySelectorAll('[id*="iab-"], [class*="iab-"]');
        iabBait.forEach(el => {
            el.style.display = 'block';
            el.style.visibility = 'visible';
            el.style.height = 'auto';
            el.style.width = 'auto';
        });
    }

    // Initialize bypass
    function init() {
        clearCookies();
        removeAdBlockElements();
        restoreContent();
        spoofBaitElements();
        neutralizeIABDetection();
        if (typeof window.ai_adb_undetected === 'function') {
            window.ai_adb_undetected(0);
        }
    }

    // Run when DOM is loaded
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }

    // Observe for dynamically added elements
    const observer = new MutationObserver(() => {
        removeAdBlockElements();
        restoreContent();
        spoofBaitElements();
        neutralizeIABDetection();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    // Periodically check for new bait elements
    setInterval(() => {
        spoofBaitElements();
        neutralizeIABDetection();
    }, 1000);
})();