Minefun Galaxy Sky Toggle

Galaxy sky overlay for Minefun (all modes)

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Minefun Galaxy Sky Toggle
// @namespace    https://greasyfork.org
// @version      1.0
// @description  Galaxy sky overlay for Minefun (all modes)
// @match        *://*minefun*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // ===== CREATE SKY OVERLAY =====
    const sky = document.createElement("div");
    sky.id = "galaxySky";
    document.body.appendChild(sky);

    Object.assign(sky.style, {
        position: "fixed",
        top: "0",
        left: "0",
        width: "100vw",
        height: "100vh",
        zIndex: "9999",
        pointerEvents: "none",
        background: "radial-gradient(circle at 20% 20%, #ff00ff, transparent 40%)," +
                    "radial-gradient(circle at 80% 30%, #00ffff, transparent 40%)," +
                    "radial-gradient(circle at 40% 70%, #ffcc00, transparent 40%)," +
                    "radial-gradient(circle at 70% 80%, #ff0033, transparent 40%)," +
                    "black",
        mixBlendMode: "screen",
        opacity: "0",
        transition: "opacity 0.5s ease",
        animation: "galaxyMove 6s infinite alternate"
    });

    // ===== ANIMATION =====
    const style = document.createElement("style");
    style.innerHTML = `
    @keyframes galaxyMove {
        0% { filter: hue-rotate(0deg) brightness(1); transform: scale(1); }
        50% { filter: hue-rotate(180deg) brightness(1.3); transform: scale(1.05); }
        100% { filter: hue-rotate(360deg) brightness(1); transform: scale(1); }
    }

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

    // ===== TOGGLE BUTTON =====
    const btn = document.createElement("div");
    btn.id = "galaxyBtn";
    btn.innerText = "Galaxy OFF";
    document.body.appendChild(btn);

    let enabled = false;

    btn.onclick = () => {
        enabled = !enabled;
        sky.style.opacity = enabled ? "1" : "0";
        btn.innerText = enabled ? "Galaxy ON" : "Galaxy OFF";
    };

    // ===== DRAG BUTTON =====
    let isDrag = false, offsetX, offsetY;

    btn.addEventListener("mousedown", (e) => {
        isDrag = true;
        offsetX = e.clientX - btn.getBoundingClientRect().left;
        offsetY = e.clientY - btn.getBoundingClientRect().top;
    });

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

    document.addEventListener("mouseup", () => {
        isDrag = false;
    });

})();