Ultimate Anti-Adblock Killer

Neutralizes adblock detection scripts without breaking major websites (YouTube-safe). Includes hotkeys (Ctrl+Shift+E / X / H) and Tampermonkey menu commands.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Ultimate Anti-Adblock Killer
// @namespace    https://tampermonkey.net/
// @version      3.8.1
// @description  Neutralizes adblock detection scripts without breaking major websites (YouTube-safe). Includes hotkeys (Ctrl+Shift+E / X / H) and Tampermonkey menu commands.
// @author       Tauã B. Kloch Leite
// @icon         https://img.icons8.com/fluency/64/ad-blocker.png
// @match        *://*/*
// @grant        GM_registerMenuCommand
// @license      GPL-3.0
// ==/UserScript==

(function() {
    'use strict';

    // =============================================
    // EXCEPTION SYSTEM
    // =============================================

    let exceptions = JSON.parse(localStorage.getItem('antiAdblockExceptions') || '[]');

    function isCurrentSiteException() {
        const hostname = window.location.hostname;
        return exceptions.some(exception => hostname.includes(exception));
    }

    // =============================================
    // ANTI-ADBLOCK REMOVAL (YouTube-safe)
    // =============================================

    const isYouTube = location.hostname.includes('youtube.com') || location.hostname.includes('youtu.be');

    function removeAntiAdblockElements() {
        if (isCurrentSiteException()) return;

        const selectors = [
            '.adblock-detected', '.anti-adblock', '.adblock-overlay', '.adblock-modal',
            '.ab-message', '.ab-modal', '.ab-detect', '.adblock-notification',
            '.adblock-warning', '.adblock-popup', '.adblock-detect', '.adblock-banner',
            '.adblock-alert', '.fc-ab-root', '.adsbox', '.ad-placeholder', '.ad-unit',
            '.notice-bar', '.paywall', '.content-locked', '.blocked-content',
            '[class*="adblock"]', '[class*="anti-adblock"]', '[class*="ab-detect"]',
            '[class*="ab-modal"]', '[class*="ab-notification"]', '[class*="fc-ab"]',
            '[class*="paywall"]', '[class*="blocked"]', '[class*="overlay"]',
            '[class*="modal"]', '[class*="popup"]', '[class*="lightbox"]',
            '#adblock-detected', '#anti-adblock', '#adblock-overlay', '#adblock-modal',
            '#ab-message', '#ab-modal', '#ab-detect', '#freestar', '#paywall',
            '#content-locked', '#modal', '#overlay'
        ];

        selectors.forEach(selector => {
            try {
                document.querySelectorAll(selector).forEach(element => {
                    try {
                        const style = window.getComputedStyle(element);
                        const zIndex = parseInt(style.zIndex);

                        if (isYouTube && zIndex > 1000) return;

                        if (style.position === 'fixed' || zIndex > 1000) {
                            element.remove();
                        }
                    } catch (e) {
                        if (!isYouTube) element.remove();
                    }
                });
            } catch (e) {}
        });

        document.querySelectorAll('div, p, section, article').forEach(element => {
            try {
                const text = element.textContent.toLowerCase();
                if (text.includes('adblock') || text.includes('disable your adblocker') || text.includes('whitelist') || text.includes('allow ads') || text.includes('adblocker detected')) {
                    const style = window.getComputedStyle(element);
                    if (style.position === 'fixed' || parseInt(style.zIndex) > 1000) {
                        if (!isYouTube) element.remove();
                    }
                }
            } catch (e) {}
        });

        document.querySelectorAll('div[style*="fixed"], div[style*="absolute"]').forEach(element => {
            try {
                const style = window.getComputedStyle(element);
                const rect = element.getBoundingClientRect();
                if ((rect.width > window.innerWidth * 0.8 || rect.height > window.innerHeight * 0.8) && parseInt(style.zIndex) > 100) {
                    if (!isYouTube) element.remove();
                }
            } catch (e) {}
        });

        if (!isYouTube && location.hostname.includes('fetchpik')) {
            document.querySelectorAll('button, a').forEach(el => {
                if ((el.textContent || '').toLowerCase().includes('adblock') || (el.textContent || '').includes('Disabled AdBlock')) {
                    el.click();
                }
            });
        }
    }

    // =============================================
    // UNBLOCK CONTENT & SCROLL
    // =============================================

    function fixBlockedContent() {
        if (isCurrentSiteException()) return;

        try {
            document.querySelectorAll('*').forEach(element => {
                try {
                    const style = window.getComputedStyle(element);
                    if (style.filter.includes('blur') || style.webkitFilter.includes('blur')) {
                        element.style.filter = 'none';
                        element.style.webkitFilter = 'none';
                    }
                } catch (e) {}
            });

            document.body.style.overflow = 'auto';
            document.documentElement.style.overflow = 'auto';

            document.querySelectorAll('body > *').forEach(element => {
                try {
                    const style = window.getComputedStyle(element);
                    if (style.position === 'fixed' && style.top === '0px' && style.left === '0px' && style.width === '100%' && style.height === '100%') {
                        element.remove();
                    }
                } catch (e) {}
            });
        } catch (e) {}
    }

    // =============================================
    // BLOCK DETECTION SCRIPTS
    // =============================================

    function blockDetectionScripts() {
        if (isCurrentSiteException()) return;

        const bPatterns = [/adblock|anti.?adblock|ab.?detect/i, /blockadblock|fuckadblock/i, /adblock\.js|antiadblock|ab\.js/i];

        const origAppend = Element.prototype.appendChild;
        Element.prototype.appendChild = function(element) {
            if (element.tagName === 'SCRIPT') {
                if (element.src && bPatterns.some(p => p.test(element.src))) return element;
                if (element.textContent && bPatterns.some(p => p.test(element.textContent))) return element;
            }
            return origAppend.call(this, element);
        };

        const origCreate = document.createElement;
        document.createElement = function(tagName) {
            const element = origCreate.call(this, tagName);
            if (tagName.toLowerCase() === 'script') {
                const origSet = element.setAttribute;
                element.setAttribute = function(name, value) {
                    if (name === 'src' && value && bPatterns.some(p => p.test(value))) return;
                    origSet.call(this, name, value);
                };
            }
            return element;
        };
    }

    // =============================================
    // EXCEPTION HANDLING
    // =============================================

    function addException() {
        const hostname = window.location.hostname;
        if (!exceptions.includes(hostname)) {
            exceptions.push(hostname);
            localStorage.setItem('antiAdblockExceptions', JSON.stringify(exceptions));
            showNotification(`✅ ${hostname} added to exceptions`);
            setTimeout(() => location.reload(), 1000);
        }
    }

    function removeException() {
        const hostname = window.location.hostname;
        const originalLength = exceptions.length;
        exceptions = exceptions.filter(site => site !== hostname && !hostname.includes(site));
        if (exceptions.length < originalLength) {
            localStorage.setItem('antiAdblockExceptions', JSON.stringify(exceptions));
            showNotification(`❌ ${hostname} removed from exceptions\nReloading...`);
            setTimeout(() => location.reload(), 1000);
        } else {
            showNotification(`ℹ️ ${hostname} was not in exceptions`);
        }
    }

    function removeAllDomainExceptions() {
        const hostname = window.location.hostname;
        const originalLength = exceptions.length;
        exceptions = exceptions.filter(site => !site.includes(hostname));
        if (exceptions.length < originalLength) {
            localStorage.setItem('antiAdblockExceptions', JSON.stringify(exceptions));
            showNotification(`🗑️ All exceptions for ${hostname} removed\nReloading...`);
            setTimeout(() => location.reload(), 1000);
        }
    }

    function showNotification(message) {
        const existing = document.querySelectorAll('.anti-adblock-notification');
        existing.forEach(el => el.remove());

        const n = document.createElement('div');
        n.className = 'anti-adblock-notification';
        n.style.cssText = 'position:fixed;top:20px;right:20px;background:#2d3748;color:white;padding:15px 20px;border-radius:8px;z-index:10000;font-family:Arial,sans-serif;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.3);border-left:4px solid #4299e1;max-width:350px;white-space:pre-line;';
        n.textContent = message;
        document.body.appendChild(n);
        setTimeout(() => n.remove(), 3000);
    }

    function showHelp() {
        const helpText = `
🛡️ Ultimate Anti-Adblock Killer Active

• Ctrl+Shift+E → Add/Remove exception
• Ctrl+Shift+X → Remove all from domain
• Ctrl+Shift+H → Help
• Tampermonkey menu for difficult sites

Site: ${window.location.hostname}
Status: ${isCurrentSiteException() ? 'EXCEPTION' : 'ACTIVE'}
        `.trim();
        showNotification(helpText);
    }

    // =============================================
    // KEYBOARD SHORTCUTS - 100% UNBLOCKABLE
    // =============================================

    window.addEventListener('keydown', function(e) {
        if (e.ctrlKey && e.shiftKey && !e.altKey && !e.metaKey) {
            if (e.key === 'E' || e.key === 'e') {
                e.preventDefault();
                e.stopImmediatePropagation();
                isCurrentSiteException() ? removeException() : addException();
                return false;
            }
            if (e.key === 'X' || e.key === 'x') {
                e.preventDefault();
                e.stopImmediatePropagation();
                removeAllDomainExceptions();
                return false;
            }
            if (e.key === 'H' || e.key === 'h') {
                e.preventDefault();
                e.stopImmediatePropagation();
                showHelp();
                return false;
            }
        }
    }, true);

    // =============================================
    // TAMPERMONKEY MENU COMMANDS
    // =============================================

    GM_registerMenuCommand('➕ Add to exceptions', addException);
    GM_registerMenuCommand('➖ Remove from exceptions', removeException);
    GM_registerMenuCommand('🗑️ Remove all from this domain', removeAllDomainExceptions);
    GM_registerMenuCommand('📋 View exception list', () => {
        alert(exceptions.length === 0 ? 'List empty' : 'Exceptions:\n\n' + exceptions.join('\n'));
    });

    // =============================================
    // INITIALIZATION
    // =============================================

    function init() {
        blockDetectionScripts();

        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', startProtection);
        } else {
            startProtection();
        }

        function startProtection() {
            removeAntiAdblockElements();
            fixBlockedContent();

            const observer = new MutationObserver(() => {
                removeAntiAdblockElements();
                fixBlockedContent();
            });

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

            setInterval(() => {
                removeAntiAdblockElements();
                fixBlockedContent();
            }, 1000);

            if (!isCurrentSiteException()) {
                setTimeout(() => showNotification('🛡️ Ultimate Anti-Adblock Killer Active'), 1000);
            }

            console.log('✅ Ultimate Anti-Adblock Killer 3.7 loaded successfully');
        }
    }

    // =============================================
    // BLOCK ANNOYING POPUPS
    // =============================================

    const originalAlert = window.alert;
    window.alert = function(message) {
        if (typeof message === 'string' && message.toLowerCase().includes('adblock')) return;
        return originalAlert.apply(this, arguments);
    };

    const originalConfirm = window.confirm;
    window.confirm = function(message) {
        if (typeof message === 'string' && message.toLowerCase().includes('adblock')) return true;
        return originalConfirm.apply(this, arguments);
    };

    // =============================================
    // START SCRIPT
    // =============================================

    init();

})();