Minefun Sky Color Shift

Change sky colors locally (client-side only)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Minefun Sky Color Shift
// @namespace    https://greasyfork.org
// @version      1.2
// @description  Change sky colors locally (client-side only)
// @match        *://*minefun*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // ===== STYLE INJECTION =====
    const style = document.createElement("style");
    style.innerHTML = `
    .sky-filter {
        filter: hue-rotate(0deg) saturate(2) brightness(1.2) !important;
        transition: filter 0.5s linear;
    }

    #skyBtn {
        position: fixed;
        top: 100px;
        right: 20px;
        z-index: 99999;
        padding: 10px 14px;
        background: #111;
        color: white;
        border: 1px solid #444;
        cursor: pointer;
        user-select: none;
        font-family: sans-serif;
    }
    `;
    document.head.appendChild(style);

    // ===== APPLY TO GAME ROOT =====
    function applySky() {
        // Minefun thường dùng body hoặc canvas wrapper
        document.body.classList.add("sky-filter");
    }

    function removeSky() {
        document.body.classList.remove("sky-filter");
    }

    // ===== BUTTON =====
    const btn = document.createElement("div");
    btn.id = "skyBtn";
    btn.innerText = "Sky OFF";
    document.body.appendChild(btn);

    let enabled = false;
    let hue = 0;
    let interval = null;

    const colorsSpeed = 20;

    btn.onclick = () => {
        enabled = !enabled;

        if (enabled) {
            btn.innerText = "Sky ON";

            applySky();

            interval = setInterval(() => {
                hue += 15;
                if (hue > 360) hue = 0;

                document.body.style.filter =
                    `hue-rotate(${hue}deg) saturate(2) brightness(1.3)`;

            }, colorsSpeed);

        } else {
            btn.innerText = "Sky OFF";

            clearInterval(interval);
            removeSky();
            document.body.style.filter = "none";
        }
    };

    // ===== DRAG BUTTON =====
    let drag = false, ox, oy;

    btn.addEventListener("mousedown", (e) => {
        drag = true;
        ox = e.clientX - btn.offsetLeft;
        oy = e.clientY - btn.offsetTop;
    });

    document.addEventListener("mousemove", (e) => {
        if (!drag) return;
        btn.style.left = (e.clientX - ox) + "px";
        btn.style.top = (e.clientY - oy) + "px";
        btn.style.right = "auto";
    });

    document.addEventListener("mouseup", () => drag = false);

})();