ZeroAd: Poki

Instant, zero-delay Poki SDK bypass with immediate hooks

Από την 21/08/2026. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
    }
})();