Minefun Galaxy Sky Toggle

Galaxy sky overlay for Minefun (all modes)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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

})();