Minefun Galaxy Sky Toggle

Galaxy sky overlay for Minefun (all modes)

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

})();