MinecraftServer.buzz Easy Vote Helper

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

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