ZeroAd: Poki

Instant, zero-delay Poki SDK bypass with immediate hooks

Versione datata 21/08/2026. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         ZeroAd: Poki
// @namespace    https://greasyfork.org/en/users/1483567-vujohn123
// @version      4.0.1
// @description  Instant, zero-delay Poki SDK bypass with immediate hooks
// @author       ZeroAd Team
// @match        *://*.poki.com/*
// @match        *://poki.com/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    if (window.__zaPokiLoaded) return;
    window.__zaPokiLoaded = true;

    const CONFIG = { DEBUG: false };
    const METRICS = {
        hooksInstalled: 0,
        interceptedCalls: 0,
        failedHooks: 0,
        rewardsGranted: 0
    };

    const log = (...args) => CONFIG.DEBUG && console.log('[ZeroAd:Poki]', ...args);
    const warn = (...args) => CONFIG.DEBUG && console.warn('[ZeroAd:Poki]', ...args);
    const error = (...args) => console.error('[ZeroAd:Poki]', ...args);

    function safeDispatchEvent(target, eventName) {
        try {
            target.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));
        } catch (e) { /* ignore */ }
    }

    function safeCallback(fn, ...args) {
        if (typeof fn === 'function') {
            try { fn(...args); } catch (e) { warn('Callback error:', e); }
        }
    }

    function hookPokiSDK(sdk) {
        if (!sdk || sdk.__zaHooked) return false;

        try {
            sdk.__zaHooked = true;

            if (typeof sdk.commercialBreak === 'function') {
                sdk.commercialBreak = () => {
                    log('commercialBreak skipped');
                    METRICS.interceptedCalls++;
                    return Promise.resolve();
                };
            }

            if (typeof sdk.rewardedBreak === 'function') {
                sdk.rewardedBreak = function(callbacks) {
                    log('rewardedBreak → instant reward');
                    METRICS.interceptedCalls++;

                    let onStart = null, onReward = null;
                    if (typeof callbacks === 'function') {
                        onReward = callbacks;
                    } else if (callbacks && typeof callbacks === 'object') {
                        onStart = callbacks.onStart;
                        onReward = callbacks.adFinished || callbacks.onComplete || callbacks.onReward;
                    }

                    safeCallback(onStart);
                    safeCallback(onReward);

                    METRICS.rewardsGranted++;
                    safeDispatchEvent(window, 'rewardedComplete');
                    safeDispatchEvent(window, 'rewardGranted');
                    safeDispatchEvent(window, 'adComplete');
                    log('✅ Reward granted instantly');
                    return Promise.resolve(true);
                };
            }

            if (typeof sdk.hoistDisplayAd === 'function') {
                sdk.hoistDisplayAd = () => { METRICS.interceptedCalls++; return false; };
            }
            if (typeof sdk.destroyDisplayAd === 'function') {
                sdk.destroyDisplayAd = () => { METRICS.interceptedCalls++; };
            }

            ['playgroundCommercialBreak', 'platformCommercialBreak'].forEach(m => {
                if (typeof sdk[m] === 'function') {
                    sdk[m] = () => { log(m + ' skipped'); METRICS.interceptedCalls++; return Promise.resolve(); };
                }
            });

            if (sdk.__monetization) {
                if (typeof sdk.__monetization.requestAd === 'function') {
                    sdk.__monetization.requestAd = () => Promise.resolve();
                }
                if (typeof sdk.__monetization.displayAd === 'function') {
                    sdk.__monetization.displayAd = () => false;
                }
                if (typeof sdk.__monetization.init === 'function') {
                    sdk.__monetization.init = () => Promise.resolve();
                }
            }

            ['happyTime','gameLoading','gameplayStart','gameplayStop','captureError','sendEvent'].forEach(m => {
                if (typeof sdk[m] === 'function') sdk[m] = () => {};
            });

            METRICS.hooksInstalled++;
            log('✓ PokiSDK hooked instantly');
            return true;

        } catch (e) {
            error('Hook failed:', e);
            METRICS.failedHooks++;
            return false;
        }
    }

    function installTrap() {
        let _PokiSDK = window.PokiSDK;
        Object.defineProperty(window, 'PokiSDK', {
            configurable: true,
            enumerable: true,
            get() { return _PokiSDK; },
            set(newValue) {
                _PokiSDK = newValue;
                if (newValue && !newValue.__zaHooked) {
                    hookPokiSDK(newValue);
                }
            }
        });
        log('✓ PokiSDK trap installed');
    }

    function hookExistingIfPresent() {
        if (window.PokiSDK && !window.PokiSDK.__zaHooked) {
            hookPokiSDK(window.PokiSDK);
        }
    }

    function setupObserver() {
        const observer = new MutationObserver(mutations => {
            for (const mutation of mutations) {
                for (const node of mutation.addedNodes) {
                    if (node.tagName === 'SCRIPT') {
                        const src = (node.src || '').toLowerCase();
                        if (src.includes('poki') && (src.includes('sdk') || src.includes('monetization'))) {
                            log('SDK script detected:', src.substring(0, 80));
                            node.addEventListener('load', () => {
                                setTimeout(hookExistingIfPresent, 0);
                            });
                        }
                    }
                }
            }
        });
        if (document.documentElement) {
            observer.observe(document.documentElement, { childList: true, subtree: true });
        }
        log('✓ MutationObserver active');
    }

    function initialize() {
        log('ZeroAd: Poki SDK v4.0.1 – Instant reward');
        installTrap();
        hookExistingIfPresent();
        setupObserver();

        window._zaMetrics = window._zaMetrics || {};
        window._zaMetrics.poki = METRICS;

        setTimeout(() => {
            log('Status:', { hookState: !!window.PokiSDK?.__zaHooked, metrics: METRICS });
        }, 5000);
    }

    initialize();

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