Ultimate Anti-Adblock Killer

The ultimate fusion: The power of aggressive adblock detection neutralization combined with user-friendly controls and advanced menu protection (Elementor/Sticky). Now with enhanced protection against "Premium/Upgrade" popups and overlay cleanup.

目前為 2025-11-23 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Ultimate Anti-Adblock Killer
// @namespace    https://tampermonkey.net/
// @version      6.1.4
// @description  The ultimate fusion: The power of aggressive adblock detection neutralization combined with user-friendly controls and advanced menu protection (Elementor/Sticky). Now with enhanced protection against "Premium/Upgrade" popups and overlay cleanup.
// @author       Tauã B. Kloch Leite
// @icon         https://img.icons8.com/fluency/64/ad-blocker.png
// @match        *://*/*
// @grant        GM_registerMenuCommand
// @grant        unsafeWindow
// @license      GPL-3.0
// @run-at       document-start
// ==/UserScript==
 
(function() {
    'use strict';
 
    // =============================================
    // 1. EXCEPTION SYSTEM AND USER INTERFACE
    // =============================================
 
    let exceptions = JSON.parse(localStorage.getItem('antiAdblockExceptions') || '[]');
 
    function isCurrentSiteException() {
        const hostname = window.location.hostname;
        return exceptions.some(exception => hostname.includes(exception));
    }
 
    function showNotification(message) {
        if (!document.body) return;
        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:2147483647;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;pointer-events:none;';
        n.textContent = message;
        document.body.appendChild(n);
        setTimeout(() => n.remove(), 3000);
    }
 
    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 showHelp() {
        const helpText = `
🛡️ Ultimate Anti-Adblock Killer (v6.1.4)
 
• Ctrl+Shift+E → Add/Remove exception
• Ctrl+Shift+X → Remove all from domain
• Ctrl+Shift+H → Help
• Tampermonkey menu available
 
Site: ${window.location.hostname}
Status: ${isCurrentSiteException() ? '⛔ EXCEPTION (Script Paused)' : '✅ ACTIVE'}
        `.trim();
        showNotification(helpText);
    }
 
    GM_registerMenuCommand('➕ Add to exceptions', addException);
    GM_registerMenuCommand('➖ Remove from exceptions', removeException);
    GM_registerMenuCommand('🗑️ Clear this domain', removeAllDomainExceptions);
    GM_registerMenuCommand('❓ Help / Status', showHelp);
 
    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();
            }
            if (e.key === 'X' || e.key === 'x') {
                e.preventDefault(); e.stopImmediatePropagation();
                removeAllDomainExceptions();
            }
            if (e.key === 'H' || e.key === 'h') {
                e.preventDefault(); e.stopImmediatePropagation();
                showHelp();
            }
        }
    }, true);
 
    if (isCurrentSiteException()) {
        console.log('UAAK: Site is an exception. Protection disabled.');
        return;
    }
 
    // =============================================
    // 2. CORE ENGINE AND DETECTION LOGIC
    // =============================================
 
    var enable_debug = false;
    
    // Detection patterns
    var adblock_pattern = /ad-block|adblock|ad block|blocking ads|bloqueur|bloqueador|Werbeblocker|&#1570;&#1583;&#1576;&#1604;&#1608;&#1603; &#1576;&#1604;&#1587;|блокировщиком/i;
    var disable_pattern = /kapat|disabl|désactiv|desactiv|desativ|deaktiv|detect|enabled|turned off|turn off|&#945;&#960;&#949;&#957;&#949;&#961;&#947;&#959;&#960;&#959;&#943;&#951;&#963;&#951;|&#1079;&#1072;&#1087;&#1088;&#1077;&#1097;&#1072;&#1090;&#1100;|állítsd le|publicités|рекламе|verhindert|advert|kapatınız/i;
    var premium_pattern = /premium account|upgrade now|no ads|vip access|register free/i; 
    
    var tagNames_pattern = /b|center|div|font|i|iframe|s|span|section|u/i;
 
    var is_core_protected = false;
    var classes = [];
 
    function debug( msg, val ) {
        if ( !enable_debug ) return;
        console.log( '%c ANTI-ADBLOCKER \n','color: white; background-color: red', msg );
        if ( val !== undefined && val.nodeType === Node.ELEMENT_NODE ) {
            console.log ( 'TagName: ' + val.nodeName + ' | Id: ' + val.id + ' | Class: ' + val.classList );
        }
    }
 
    function addStyle(str) {
        var style = document.createElement('style');
        style.innerHTML = str;
        (document.body || document.head || document.documentElement).appendChild( style );
    }
 
    function randomInt( min, max ) {
        if ( max === undefined ) { max = min; min = 0; }
        return Math.floor(min + Math.random() * (max - min + 1));
    }
 
    function getRandomName( size ) {
        var charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        var name = '';
        for (var i = 0; i < (size||randomInt(10,20)); ++i) {
            name += charset.charAt( Math.floor( Math.random() * charset.length) );
        }
        return name;
    }
 
    function addRandomClass( el ) {
        let name = getRandomName();
        el.classList.add( name );
        return name;
    }
 
    function enableRightClick() {
        if (typeof jQuery !== 'undefined') {
            jQuery(function($) {
                $('img').removeAttr('onmousedown').removeAttr('onselectstart').removeAttr('ondragstart');
                $(document).off('contextmenu selectstart dragstart');
                $(document.body).off('contextmenu selectstart dragstart');
            });
        } else {
            const images = document.querySelectorAll('img');
            images.forEach(img => {
                img.removeAttribute('onmousedown');
                img.removeAttribute('onselectstart');
                img.removeAttribute('ondragstart');
            });
        }
        document.oncontextmenu = null;
        document.onmousedown = null;
        document.body.oncontextmenu = null;
        document.body.onselectstart = null;
        document.body.ondragstart = null;
    }
 
    function isElementBlur( el ) {
        if (el instanceof Element) {
          var style = window.getComputedStyle( el );
          var filter = style.getPropertyValue( 'filter' );
          return ( (/blur/i).test( filter ) );
        }
    }
 
    function isElementFixed( el ) {
        if (el instanceof Element) {
          var style = window.getComputedStyle( el );
          return ( style.getPropertyValue( 'position' ) == 'fixed' );
        }
    }
 
    function isOverflowHidden( el ) {
        if (el instanceof Element) {
          var style = window.getComputedStyle( el );
          return ( style.getPropertyValue( 'overflow' ) == 'hidden' );
        }
    }
    
    function isNotHidden( el ) {
        if (el instanceof Element) {
          var style = window.getComputedStyle( el );
          return ( style.getPropertyValue( 'display' ) != 'none' );
        }
    }
 
    // Checks for full-screen blackout overlays
    function isBlackoutModal( el ) {
        if (el instanceof Element) {
          var style = window.getComputedStyle( el );
          var position = style.getPropertyValue( 'position' );
          
          if (position !== 'fixed') return false;
 
          var top = parseInt( style.getPropertyValue( 'top' ) ) || 0;
          var left = parseInt( style.getPropertyValue( 'left' ) ) || 0;
          var right = parseInt( style.getPropertyValue( 'right' ) ) || 0;
          var bottom = parseInt( style.getPropertyValue( 'bottom' ) ) || 0;
          
          var coversHeight = el.offsetHeight >= window.innerHeight * 0.9;
          var coversWidth = el.offsetWidth >= window.innerWidth * 0.9;
          var anchored = (top <= 5 && left <= 5) || (right <= 5 && bottom <= 5) || (top <= 5 && right <= 5);
 
          return coversHeight && coversWidth && anchored;
        }
        return false;
    }
 
    // Enhanced text detection to include Premium/Upgrade popups
    function isAntiAdblockText( value ) {
        if (adblock_pattern.test( value ) && disable_pattern.test( value )) return true;
        
        // Detection for "Premium/Upgrade" detection popups
        if (premium_pattern.test(value) && (value.toLowerCase().includes('ads') || value.toLowerCase().includes('account'))) return true;
        
        return false;
    }
 
    function isModalWindows( el ) {
        return isElementFixed ( el ) && ( isAntiAdblockText( el.textContent ) || isBlackoutModal( el ) );
    }
 
    // Advanced safety check for Navigation Menus and Sticky Headers
    function isSafetyHeader( el ) {
        if (!el || !el.getBoundingClientRect) return false;
        
        if (el.tagName === 'HEADER' || el.tagName === 'NAV') return true;
        if (el.closest('[data-elementor-type="header"]')) return true;
        if (el.getAttribute('data-elementor-type') === 'header') return true;
 
        const rect = el.getBoundingClientRect();
        if (rect.top <= 5 && rect.height < 300 && rect.width > window.innerWidth * 0.8) {
             if (el.querySelector('nav') || el.querySelector('[role="navigation"]') || el.querySelector('.menu')) {
                 return true;
             }
        }
        return false;
    }
 
    // Blocks attempts to remove critical page elements (Head/Body)
    function protectCore() {
        if ( is_core_protected ) return;
        if (typeof unsafeWindow === 'undefined') {
          const unsafeWindow = window;
        }
 
        const $_removeChild = unsafeWindow.Node.prototype.removeChild;
        unsafeWindow.Node.prototype.removeChild = function( node ) {
            if ( node.nodeName == 'HEAD' || (node.parentNode.nodeName == 'HEAD' && !(/META|SCRIPT|STYLE/.test(node.nodeName)) )  ){
                return debug( 'Blocked delete HEAD child', node );
            }
            else if ( node.nodeName == 'BODY' ){
                if ( node.parentNode == document.body.firstElementChild ) {
                    return debug( 'Blocked delete BODY', node );
                }
                return debug( 'Blocked delete BODY', node );
            }
            $_removeChild.apply( this, arguments );
        };
 
        // Blocks attempts to overwrite body content with detection messages
        const $_innerHTML = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
        if ($_innerHTML && $_innerHTML.set) {
            Object.defineProperty(Element.prototype, 'innerHTML', {
                set: function (value) {
                    if ( this.nodeName == 'BODY' || isAntiAdblockText( value ) ){
                        return debug( 'Blocked innerHTML change', value );
                    }
                    return $_innerHTML.set.call(this, value);
                },
                get: function() { return $_innerHTML.get.call(this); },
                configurable: true
            });
        }
        is_core_protected = true;
    }
 
    function unblockScroll() {
        if ( isOverflowHidden( document.body ) ) {
            document.body.setAttribute('style', (document.body.getAttribute('style')||'').replace('overflow: visible !important;','') + 'overflow: visible !important;');
            document.body.classList.add( 'scroll_on' );
        }
        if ( isOverflowHidden( document.documentElement ) ) {
            document.documentElement.setAttribute('style', (document.documentElement.getAttribute('style')||'').replace('overflow: visible !important;','') + 'overflow: visible !important;');
            document.documentElement.classList.add( 'scroll_on' );
        }
    }
 
    function removeBackStuff() {
        document.querySelectorAll( 'b,center,div,font,i,iframe,s,span,section,u' ).forEach( ( el ) => {
            if ( isBlackoutModal( el ) && !isSafetyHeader(el) ) {
                el.removeAttribute('id');
                el.removeAttribute('class');
                el.setAttribute('style', (el.getAttribute('style')||'') + ';display: none !important;');
                el.classList.add( 'hide_modal' );
            }
            else if ( isElementBlur( el ) ) {
                el.classList.add( 'un_blur' );
            }
        });
        setTimeout( unblockScroll, 500);
    }
 
    function checkModals() {
        var modalFound = false;
        document.querySelectorAll( 'b,center,div,font,i,iframe,s,span,section,u' ).forEach( ( el ) => {
            if ( isModalWindows( el ) && isNotHidden( el ) ) {
                modalFound = true;
                removeModal( el );
            }
        });
        if ( modalFound ) {
            setTimeout( removeBackStuff, 150);
        }
    }
 
    function removeModal( el, isNew ) {
        if ( (new RegExp(classes.join('|'))).test( el.classList ) ) return;
        
        // --- SAFETY CHECK ---
        if (isSafetyHeader(el)) return;
 
        el.removeAttribute('id');
        el.removeAttribute('class');
        
        var class_name = addRandomClass( el );
        classes.push( class_name );
 
        el.setAttribute('style', (el.getAttribute('style')||'') + ';display: none !important;');
        addStyle( '.' + class_name + '{ display: none !important; }' );
 
        // --- PARENT OVERLAY CLEANUP ---
        // If the element was part of a wrapper/overlay, remove the parent too
        try {
            var parent = el.parentElement;
            if (parent && parent.tagName !== 'BODY' && parent.tagName !== 'HTML') {
                var parentStyle = window.getComputedStyle(parent);
                // If parent is fixed/absolute and has no other visible content, it's likely the shadow overlay
                if (parentStyle.position === 'fixed' || parentStyle.position === 'absolute') {
                    if (!isSafetyHeader(parent)) {
                        removeModal(parent, false); // Recursively remove the parent wrapper
                    }
                }
            }
        } catch(e) {}
        // ------------------------------
 
        if ( isNew ) {
            setTimeout( removeBackStuff, 150);
        }
    }
 
    // Initialization logic
    window.addEventListener('DOMContentLoaded', (event) => {
        classes.push( getRandomName() );
 
        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
        var observer = new MutationObserver( (mutations) => {
            mutations.forEach( (mutation) => {
                if ( mutation.addedNodes.length ) {
                    Array.prototype.forEach.call( mutation.addedNodes, ( el ) => {
                        if ( !tagNames_pattern.test ( el.tagName ) ) return;
                        if ( isModalWindows( el ) && isNotHidden( el ) ) {
                            removeModal( el, true );
                        }
                    });
                }
            });
        });
 
        if (document.body) {
            observer.observe(document.body, { childList : true, subtree : true });
            setTimeout(() => showNotification('🛡️ Ultimate Anti-Adblock Killer Active'), 1000);
        }
 
        setTimeout( function() { checkModals(); }, 150 );
        addStyle( 'body { user-select: auto !important; } body.scroll_on, html.scroll_on { overflow: visible !important; } .hide_modal { display: none !important; } .un_blur { -webkit-filter: blur(0px) !important; filter: blur(0px) !important; }' );
    });
 
    window.addEventListener('load', (event) => {
        setTimeout( function() {
            enableRightClick();
            checkModals();
        }, 1500 );
    });
 
    protectCore();
 
})();