MinecraftServer.buzz Easy Vote Helper

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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