Minefun Sky Color Shift

Change sky colors locally (client-side only)

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

})();