ZeroAd Engine

Bypass ads and skip interruptions in HTML5 games. Instantly auto-completes Poki SDK ads (commercialBreak/rewardedBreak), AdInPlay ads, and CrazyGames reward overlays/promo screens. Blocks iframes, video ads, intrusive containers, and adblock detection warnings. Improved future-proof AdInPlay bypass + adblock evasion (tested on taming.io, Poki, CrazyGames, Ninja.io).

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name ZeroAd Engine
// @namespace http://tampermonkey.net/
// @version 2026.02.12.1
// @description Bypass ads and skip interruptions in HTML5 games. Instantly auto-completes Poki SDK ads (commercialBreak/rewardedBreak), AdInPlay ads, and CrazyGames reward overlays/promo screens. Blocks iframes, video ads, intrusive containers, and adblock detection warnings. Improved future-proof AdInPlay bypass + adblock evasion (tested on taming.io, Poki, CrazyGames, Ninja.io).
// @author Updated with Grok
// @match *://*/*
// @license MIT
// @grant none
// ==/UserScript==

(function () {
    'use strict';

    /////////////////////////////////////////////
    // [1] Robust Direct Function Patch for PokiSDK
    /////////////////////////////////////////////

    function patchPokiSDK() {
        if (typeof window.PokiSDK !== 'object') return false;

        const sdk = window.PokiSDK;

        if (sdk.__patched) return true;
        sdk.__patched = true;

        const instantResolve = (value = undefined) => Promise.resolve(value);

        if (typeof sdk.init === 'function') {
            sdk.init = function (...args) {
                console.log('[AdBypasser] 🚀 PokiSDK.init instantly resolved');
                return instantResolve();
            };
        }

        if (typeof sdk.commercialBreak === 'function') {
            sdk.commercialBreak = function (onStart) {
                console.log('[AdBypasser] ⏭ PokiSDK.commercialBreak skipped');
                if (typeof onStart === 'function') onStart();
                return instantResolve();
            };
        }

        if (typeof sdk.rewardedBreak === 'function') {
            sdk.rewardedBreak = function (options = {}) {
                console.log('[AdBypasser] 🎁 PokiSDK.rewardedBreak instantly rewarded');
                if (typeof options === 'function') options();
                else if (typeof options.onStart === 'function') options.onStart();
                return instantResolve(true);
            };
        }

        if (typeof sdk.displayAd === 'function') {
            sdk.displayAd = function () {
                console.log('[AdBypasser] 🚫 PokiSDK.displayAd blocked');
                return instantResolve();
            };
        }

        if (typeof sdk.destroyAd === 'function') {
            sdk.destroyAd = function () {
                console.log('[AdBypasser] 🗑️ PokiSDK.destroyAd suppressed');
            };
        }

        console.log('[AdBypasser] 🧠 PokiSDK fully patched');
        return true;
    }

    /////////////////////////////////////////////
    // [2] Enhanced AdInPlay SDK Patch (future-proof + callback/promise support)
    /////////////////////////////////////////////

    function patchAdInPlay() {
        if (typeof window.adinplay !== 'object' || window.adinplay.__patched) return;

        window.adinplay.__patched = true;
        console.log('[AdBypasser] 🔒 AdInPlay SDK neutralized (enhanced)');

        const blockedMethods = [
            'play', 'preroll', 'midroll', 'postroll', 'banner',
            'rewarded', 'reward', 'rewardVideo', 'interstitial',
            'show', 'showAd', 'display', 'displayAd', 'init'
        ];

        window.adinplay = new Proxy(window.adinplay, {
            get(target, prop) {
                if (blockedMethods.includes(prop)) {
                    return (...args) => {
                        console.log(`[AdBypasser] ⛔ AdInPlay.${String(prop)}() blocked & resolved`);
                        // Call any callbacks (common pattern)
                        args.forEach(arg => {
                            if (typeof arg === 'function') arg();
                        });
                        // Resolve with success for rewarded types
                        const isRewarded = /reward/i.test(String(prop));
                        return Promise.resolve(isRewarded ? true : undefined);
                    };
                }
                return target[prop];
            }
        });
    }

    /////////////////////////////////////////////
    // [3] DOM Ad + Adblock Warning Nuker Selectors
    /////////////////////////////////////////////

    const adSelectors = [
        '#preroll', '#adsbox',
        'iframe[src*="ads"]', 'iframe[title="Advertisement"]',
        'video[title="Advertisement"]',
        '[id^="ad_"]', '[id$="_ad"]', '[id="ad"]',
        '[class="ad"]', '[class^="ad-"]', '[class$="-ad"]',
        '[class~="ad-banner"]', '[class~="adbox"]', '[class~="adunit"]',
        '[class*="pokiSdk"]', 'div[id^="google_ads"]', 'div[id^="div-gpt"]',
        'div[class*="banner-ad"]', 'div[class*="ad-wrapper"]',
        'script[src*="ads"]',
        '.pokiSdkContainer', '.pokiSdkVideoContainer', '.pokiSDKAdContainer',
        '.pokiSdkSpinnerContainer', '.pokiSdkPauseButtonContainer', '.pokiSdkStartAdButton',
        '.ad-container', '.video-ad', '.interstitial-ad', '.rewarded-ad',
        '[class*="poki-pill"]', '.poki-pill',
        // Adblock detection/warning overlays (common patterns)
        '[class*="adblock"]', '[id*="adblock"]',
        '[class*="blocker"]', '[id*="blocker"]',
        '.adblock-warning', '.adblocker-modal', '.adblock-detected',
        '#adblock', '#disableAdblock', '.please-disable-adblock',
        '.adb-modal', '.adblocker-message', '.disable-adblock-message'
    ];

    const removedSelectors = new Set();

    function removeAdElements() {
        adSelectors.forEach(selector => {
            const elements = document.querySelectorAll(selector);
            if (elements.length > 0) {
                elements.forEach(el => el.remove());
                if (!removedSelectors.has(selector)) {
                    console.log(`[AdBypasser] 💣 Removed: ${selector}`);
                    removedSelectors.add(selector);
                }
            }
        });
    }

    function safeRemoveAdElements() {
        if ('requestIdleCallback' in window) {
            requestIdleCallback(removeAdElements, { timeout: 100 });
        } else {
            setTimeout(removeAdElements, 0);
        }
    }

    /////////////////////////////////////////////
    // [4] CrazyGames Promo Skip
    /////////////////////////////////////////////

    function handleCrazyGamesPromo() {
        const btn = document.getElementById('mainContinuePlayingButton');
        if (btn) {
            console.log('[AdBypasser] 🎯 CrazyGames promo detected — auto-clicking Continue');
            btn.click();
            let promoDiv = btn.closest('div.MuiGrid-root');
            if (promoDiv) {
                promoDiv.remove();
                console.log('[AdBypasser] 💥 CrazyGames promo container removed');
            }
        }
    }

    /////////////////////////////////////////////
    // [5] MutationObserver
    /////////////////////////////////////////////

    function startMutationWatch() {
        const observer = new MutationObserver(() => {
            patchAdInPlay();
            safeRemoveAdElements();
            handleCrazyGamesPromo();
        });

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

        console.log('[AdBypasser] 👁️ MutationObserver activated');
    }

    /////////////////////////////////////////////
    // [6] Iframe Ad Remover
    /////////////////////////////////////////////

    const iframeObserver = new MutationObserver(() => {
        document.querySelectorAll('iframe').forEach(iframe => {
            try {
                const src = iframe.src || iframe.getAttribute('src');
                if (src && /ads|doubleclick|preroll|videoads/i.test(src)) {
                    iframe.remove();
                    console.log('[AdBypasser] 🪓 Removed suspicious iframe:', src);
                }
            } catch (e) { }
        });
    });

    iframeObserver.observe(document.body || document.documentElement, {
        childList: true,
        subtree: true
    });

    /////////////////////////////////////////////
    // [7] Initialization
    /////////////////////////////////////////////

    window.addEventListener('DOMContentLoaded', () => {
        let attempts = 0;
        const maxAttempts = 20;
        const interval = setInterval(() => {
            if (patchPokiSDK() || attempts++ >= maxAttempts) {
                clearInterval(interval);
                if (attempts >= maxAttempts) {
                    console.warn('[AdBypasser] PokiSDK patch timeout');
                }
            }
        }, 800);

        patchAdInPlay();
        safeRemoveAdElements();
        handleCrazyGamesPromo();
        startMutationWatch();
    });

    const runtime = setInterval(() => {
        patchPokiSDK();
        patchAdInPlay();
        safeRemoveAdElements();
        handleCrazyGamesPromo();
    }, 1000);

    setTimeout(() => {
        clearInterval(runtime);
        console.log('[AdBypasser] 🛑 Startup interval cleared');
    }, 30000);

})();