Minefun Galaxy Sky Toggle

Galaxy sky overlay for Minefun (all modes)

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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

})();