CellCraft FPS Boost with Menu

FPS boost for CellCraft by disabling effects + adding a toggle menu + S E N S E branding

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         CellCraft FPS Boost with Menu
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  FPS boost for CellCraft by disabling effects + adding a toggle menu + S E N S E branding
// @author       S E N S E
// @license      S E N S E
// @match        *://cellcraft.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let fpsBoost = false;

    function setBoostMode(enable) {
        if (enable) {
            document.body.style.setProperty("image-rendering", "pixelated", "important");
            let styles = `
                * {
                    transition: none !important;
                    animation: none !important;
                }
                canvas {
                    filter: brightness(1.1) contrast(1.05);
                }
            `;
            let styleSheet = document.createElement("style");
            styleSheet.id = "fpsBoostStyles";
            styleSheet.innerHTML = styles;
            document.head.appendChild(styleSheet);
        } else {
            document.getElementById("fpsBoostStyles")?.remove();
            document.body.style.removeProperty("image-rendering");
        }
        fpsBoost = enable;
        showBanner(fpsBoost ? "FPS Boost by S E N S E: ON" : "FPS Boost: OFF", fpsBoost ? "green" : "red");
    }

    function createMenu() {
        let menu = document.createElement("div");
        menu.id = "fpsMenu";
        menu.style.position = "fixed";
        menu.style.top = "10px";
        menu.style.right = "10px";
        menu.style.zIndex = "9999";
        menu.style.background = "rgba(0,0,0,0.7)";
        menu.style.color = "#fff";
        menu.style.padding = "8px";
        menu.style.borderRadius = "6px";
        menu.style.fontSize = "14px";
        menu.style.fontFamily = "Arial, sans-serif";
        menu.style.textAlign = "center";
        menu.innerHTML = `
            <b>FPS Boost</b><br>
            <button id="toggleFPSBoost" style="margin-top:5px;">OFF</button>
            <div style="font-size:12px; margin-top:4px; opacity:0.7;">By S E N S E</div>
        `;
        document.body.appendChild(menu);

        document.getElementById("toggleFPSBoost").onclick = function() {
            setBoostMode(!fpsBoost);
            this.innerText = fpsBoost ? "ON" : "OFF";
            this.style.background = fpsBoost ? "green" : "";
        };
    }

    function showBanner(text, color) {
        let banner = document.createElement("div");
        banner.innerText = text;
        banner.style.position = "fixed";
        banner.style.top = "50px";
        banner.style.right = "50%";
        banner.style.transform = "translateX(50%)";
        banner.style.background = color;
        banner.style.color = "#fff";
        banner.style.padding = "10px 20px";
        banner.style.borderRadius = "8px";
        banner.style.fontSize = "14px";
        banner.style.zIndex = "10000";
        banner.style.boxShadow = "0 2px 8px rgba(0,0,0,0.3)";
        document.body.appendChild(banner);
        setTimeout(() => {
            banner.remove();
        }, 2500);
    }

    window.addEventListener("load", createMenu);
})();