MinecraftServer.buzz Easy Vote Helper

Adds a quick vote button to easily open all vote links for a Minecraft server page.

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         MinecraftServer.buzz Easy Vote Helper
// @namespace    https://minecraftserver.buzz/
// @version      1.0
// @description  Adds a quick vote button to easily open all vote links for a Minecraft server page.
// @author       minecraftserver.buzz
// @license      MIT
// @match        https://minecraftserver.buzz/server/*
// @icon         https://minecraftserver.buzz/favicon.ico
// @grant        none
// ==/UserScript==

(function () {
    "use strict";

    const BUTTON_TEXT = "⭐ Vote for this Server";
    const BUTTON_COLOR = "#facc15";
    const BUTTON_TEXT_COLOR = "#000";
    const Z_INDEX = 9999;

    const btn = document.createElement("button");
    btn.innerText = BUTTON_TEXT;

    Object.assign(btn.style, {
        position: "fixed",
        bottom: "20px",
        right: "20px",
        padding: "14px 18px",
        fontSize: "16px",
        fontWeight: "bold",
        background: BUTTON_COLOR,
        color: BUTTON_TEXT_COLOR,
        border: "none",
        borderRadius: "10px",
        cursor: "pointer",
        boxShadow: "0 6px 16px rgba(0,0,0,0.3)",
        zIndex: Z_INDEX,
    });

    document.body.appendChild(btn);

    function getVoteLinks() {
        const anchors = document.querySelectorAll("a[href*='vote']");
        const links = new Set();

        anchors.forEach(a => {
            const url = a.href;
            if (
                url.includes("minecraft") ||
                url.includes("vote") ||
                url.includes("server")
            ) {
                links.add(url);
            }
        });

        return Array.from(links);
    }

    btn.addEventListener("click", () => {
        const links = getVoteLinks();

        if (links.length === 0) {
            alert("No vote links found on this page.");
            return;
        }

        if (!confirm(`Open ${links.length} vote page(s)?`)) return;

        links.forEach((url, i) => {
            setTimeout(() => {
                window.open(url, "_blank");
            }, i * 600);
        });
    });
})();