MooMoo Performance Menu

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

})();