MooMoo Performance Menu

FPS Booster For PC low-end By Zama (Not Hack! :D)

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         MooMoo Performance Menu
// @namespace    moomoo.optimizer
// @version      2.1
// @description  FPS Booster For PC low-end By Zama (Not Hack! :D)
// @author       Zama
// @match        *://moomoo.io/*
// @match        *://*.moomoo.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const STORAGE_KEY = "moomoo_performance_settings";

    let settings = JSON.parse(
        localStorage.getItem(STORAGE_KEY) ||
        '{"optimizer":true,"fps":true,"video":true,"ultra":false,"night":false}'
    );

    let styleTag = null;
    let nightOverlay = null;

    function saveSettings() {
        localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
    }

    function applyOptimizer() {

        if (styleTag) styleTag.remove();

        styleTag = document.createElement("style");

        let css = "";

        if (settings.optimizer) {
            css += `
                *,
                *::before,
                *::after{
                    animation:none!important;
                    transition:none!important;
                    box-shadow:none!important;
                    text-shadow:none!important;
                }
            `;
        }

        if (settings.fps) {
            css += `
                canvas{
                    image-rendering:pixelated!important;
                }
            `;
        }

        if (settings.ultra) {
            css += `
                *{
                    filter:none!important;
                    backdrop-filter:none!important;
                }
            `;
        }

        styleTag.textContent = css;
        document.head.appendChild(styleTag);

        if (settings.video) {
            document.querySelectorAll("video").forEach(v => {
                v.style.display = "none";
            });
        }

        if (settings.ultra) {
            document.querySelectorAll("iframe").forEach(i => {
                i.style.display = "none";
            });
        }

        // NIGHT MODE
        if (settings.night) {

            if (!nightOverlay) {

                nightOverlay = document.createElement("div");

                Object.assign(nightOverlay.style, {
                    position: "fixed",
                    inset: "0",
                    background: "rgba(0,0,0,0.25)",
                    pointerEvents: "none",
                    zIndex: "999998"
                });

                document.body.appendChild(nightOverlay);
            }

        } else {

            if (nightOverlay) {
                nightOverlay.remove();
                nightOverlay = null;
            }
        }

        console.log("Optimizer Updated", settings);
    }

    applyOptimizer();

    const menu = document.createElement("div");

    Object.assign(menu.style, {
        position: "fixed",
        top: "60px",
        right: "10px",
        width: "250px",
        background: "rgba(0,0,0,0.85)",
        color: "white",
        padding: "10px",
        borderRadius: "8px",
        zIndex: "999999",
        fontFamily: "Arial",
        display: "none"
    });

    document.body.appendChild(menu);

    function createToggle(label, key) {

        const row = document.createElement("div");
        row.style.marginBottom = "8px";

        const checkbox = document.createElement("input");
        checkbox.type = "checkbox";
        checkbox.checked = settings[key];

        checkbox.addEventListener("change", () => {
            settings[key] = checkbox.checked;
            saveSettings();
            applyOptimizer();
        });

        row.appendChild(checkbox);

        const text = document.createElement("span");
        text.textContent = " " + label;

        row.appendChild(text);

        return row;
    }

    const title = document.createElement("h3");
    title.textContent = "Performance Menu By Zama";
    title.style.marginTop = "0";

    menu.appendChild(title);

    menu.appendChild(createToggle("Optimizer", "optimizer"));
    menu.appendChild(createToggle("FPS Stabilizer", "fps"));
    menu.appendChild(createToggle("Hide Videos", "video"));
    menu.appendChild(createToggle("Ultra Low Mode", "ultra"));
    menu.appendChild(createToggle("Night Mode", "night"));

    const info = document.createElement("div");
    info.style.marginTop = "10px";
    info.innerHTML = "Press ESC For Open/Close Menu";
    menu.appendChild(info);

    document.addEventListener("keydown", (e) => {

        if (e.key === "Escape") {

            menu.style.display =
                menu.style.display === "none"
                    ? "block"
                    : "none";
        }
    });

    const fpsBox = document.createElement("div");

    Object.assign(fpsBox.style, {
        position: "fixed",
        top: "10px",
        right: "10px",
        background: "rgba(0,0,0,0.8)",
        color: "lime",
        padding: "5px 10px",
        borderRadius: "6px",
        zIndex: "999999",
        fontFamily: "monospace"
    });

    document.body.appendChild(fpsBox);

    let last = performance.now();
    let frames = 0;

    function fpsLoop(now) {

        frames++;

        if (now - last >= 1000) {
            fpsBox.textContent = `FPS: ${frames}`;
            frames = 0;
            last = now;
        }

        requestAnimationFrame(fpsLoop);
    }

    requestAnimationFrame(fpsLoop);

})();