FPS-booster

Verwijdert advertenties en heft de FPS-limiet in Agar.io op

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         FPS Booster
// @name:tr      FPS Artırıcı
// @name:de      FPS-Booster
// @name:fr      Booster de FPS
// @name:es      Potenciador de FPS
// @name:pt-BR   Aumentador de FPS
// @name:ru      Ускоритель FPS
// @name:ja      FPSブースター
// @name:ko      FPS 부스터
// @name:zh-CN   FPS 提升器
// @name:zh-TW   FPS 提升器
// @name:ar      مُعزِّز FPS
// @name:it      Booster FPS
// @name:nl      FPS-booster
// @name:pl      Booster FPS
// @name:sv      FPS-booster
// @name:uk      Прискорювач FPS
// @name:id      Peningkat FPS
// @name:vi      Trình tăng FPS
// @name:hi      FPS बूस्टर
// @description        Removes advertisements and uncaps the FPS in Agar.io
// @description:tr     Agar.io'da reklamları kaldırır ve FPS sınırını kaldırır
// @description:de     Entfernt Werbung und hebt das FPS-Limit in Agar.io auf
// @description:fr     Supprime les publicités et supprime la limite de FPS dans Agar.io
// @description:es     Elimina anuncios y elimina el límite de FPS en Agar.io
// @description:pt-BR  Remove anúncios e remove o limite de FPS no Agar.io
// @description:ru     Удаляет рекламу и снимает ограничение FPS в Agar.io
// @description:ja     Agar.ioで広告を削除し、FPS制限を解除します
// @description:ko     Agar.io에서 광고를 제거하고 FPS 제한을 해제합니다
// @description:zh-CN  移除广告并解除Agar.io中的FPS限制
// @description:zh-TW  移除廣告並解除Agar.io中的FPS限制
// @description:ar     يزيل الإعلانات ويزيل حد FPS في Agar.io
// @description:it     Rimuove le pubblicità e rimuove il limite FPS in Agar.io
// @description:nl     Verwijdert advertenties en heft de FPS-limiet in Agar.io op
// @description:pl     Usuwa reklamy i znosi limit FPS w Agar.io
// @description:sv     Tar bort annonser och tar bort FPS-begränsningen i Agar.io
// @description:uk     Видаляє рекламу та знімає обмеження FPS в Agar.io
// @description:id     Menghapus iklan dan menghilangkan batas FPS di Agar.io
// @description:vi     Xóa quảng cáo và bỏ giới hạn FPS trong Agar.io
// @description:hi     Agar.io में विज्ञापन हटाता है और FPS सीमा हटाता है
// @namespace    https://greasyfork.org/users/1372128
// @version      1.0
// @author       Dragon9135
// @icon         https://agar.io/favicon.ico
// @match        *://agar.io/*
// @run-at       document-start
// @grant        unsafeWindow
// @license      MPL-2.0
// ==/UserScript==

(function() {
    'use strict';

    function find_node(where = window.agarApp?.home, cond) {
        const results = [];
        if (!where) return results;

        const find_static = (staticWhere, condition) => {
            function each_children(child, depth) {
                depth += 1;
                child.forEach(ch => {
                    if (condition(ch, depth)) results.push(ch);
                    ch.children && each_children(ch.children, depth);
                });
            }
            each_children(staticWhere, -1);
            return results;
        };

        function each_children(child, depth) {
            depth += 1;
            if (cond(child, depth)) results.push(child);
            child._staticTrees && find_static(child._staticTrees, cond);

            child.$children?.forEach(ch => each_children(ch, depth));
            child.children?.forEach(ch => each_children(ch, depth));
            child._vnode?.children?.forEach(ch => each_children(ch, depth));
            child._vnode?.componentOptions?.children?.forEach(ch => each_children(ch, depth));
        }

        each_children(where, -1);
        return results;
    }

    function overrideMethod(obj, methodName, getMethod) {
        if (!obj || !obj[methodName]) return;
        const originalMethod = obj[methodName];
        obj[methodName] = function () {
            return getMethod(originalMethod, arguments);
        };
    }

    function applyFpsBoost() {
        if (window.core && window.core.setFpsCap && !window.core._fpsUncapped) {
            overrideMethod(window.core, 'setFpsCap', (originalMethod) => {
                return originalMethod(-1);

            });
            window.core.setFpsCap(-1);
            window.core._fpsUncapped = true;
            console.log("[Booster] FPS Uncapped.");
        }
    }

    function applyAdBlocker() {
        if (!window.agarApp || !window.agarApp.home) return;

        if (!window.agarApp.ads || !window.agarApp.ads._mocked) {
            window.agarApp.ads = {
                _mocked: true,
                requestAds() {}, requestAd() {}, refreshAd() {}, destroyAd() {}, adSlots() {},
                enableTargetedAds() {}, disableTargetedAds() {}, isTargeted() { return false; },
                supersonicAds: {
                    BrandConnectReadyEvent() {}, BrandConnectDoneEvent() {}, BrandConnectOpenEvent() {},
                    BrandConnectCloseEvent() {}, BrandConnectCompletedEvent() {}, hasEngagement() { return false; }
                }
            };
            console.log("[Booster] Ad APIs mocked.");
        }

        find_node(window.agarApp.home, child => child.$vnode?.tag?.includes('-ads'))
            .forEach(child => child.$destroy());
        find_node(window.agarApp.home, child => child.$vnode?.tag?.includes('-promo'))
            .forEach(child => child.$destroy());

        find_node(window.agarApp.home, child => child.elm?.id?.includes('agar-io'))
            .forEach(child => child.elm?.parentElement?.removeChild(child.elm));

        find_node(window.agarApp.home, child => child.playVideoAd)
            .forEach(elem => {
                elem.getVideoTimestamp = () => Date.now();
            });

        const adNodes = find_node(window.agarApp.home, child => Object.getPrototypeOf(child).hasOwnProperty('hasBottomAd'));
        adNodes.forEach(vnode => {
            if (vnode._computedWatchers) {
                ['hasBottomAd', 'hasSideAds'].forEach(prop => {
                    if (vnode._computedWatchers[prop]) {
                        vnode._computedWatchers[prop].getter = () => false;
                    }
                });
            }
            try {
                Object.defineProperties(vnode, {
                    hasBottomAd: { get: () => false },
                    fastEntry: { get: () => true }

                });
            } catch (e) {}
        });

        document.documentElement.style.setProperty('--bottom-banner-height', '0px', 'important');
    }

    document.addEventListener('update_user_info', e => {
        if (e.detail && !e.detail.isPayingUser && !e.detail._bypassed) {
            e.stopPropagation();
            const detail = { ...e.detail, isPayingUser: true, _bypassed: true };
            const ev = new CustomEvent('update_user_info', { detail });
            document.dispatchEvent(ev);
        }
    });

    const initInterval = setInterval(() => {
        if (window.agarApp && window.core) {
            applyFpsBoost();
            applyAdBlocker();
        }
    }, 500);

    setTimeout(() => {
        clearInterval(initInterval);
        setInterval(() => {
            applyFpsBoost();
            applyAdBlocker();
        }, 2500);
    }, 15000);

})();