MinecraftServer.buzz Easy Vote Helper

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

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