KEK UI

Hordes UI Script

当前为 2024-02-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        KEK UI
// @description Hordes UI Script
// @namespace   https://hordes.io/
// @match       https://hordes.io/play
// @run-at      document-start
// @icon        https://www.google.com/s2/favicons?sz=64&domain=hordes.io
// @license     KEK
// @author      Scrizz and Grigory
// @version     0.0.1
// @grant       none
// ==/UserScript==

'use strict';

const checkLayoutInterval = setInterval(() => {
    const layout = document.querySelector(".l-ui.layout");
    if (layout) {
        clearInterval(checkLayoutInterval);
        fetch("https://api.github.com/repos/hordesmod/kek-ui/releases/latest")
            .then(response => response.json())
            .then(data => {
                const newWindow = document.createElement("div");
                newWindow.classList.add("window", "panel-black");
                newWindow.style.position = "absolute";
                newWindow.style.width = "366px";
                newWindow.style.top = "50%";
                newWindow.style.left = "50%";
                newWindow.style.textAlign = "center";
                newWindow.style.padding = "12px";
                newWindow.style.transform = "translate(-50%, -50%)";

                const titleFrame = document.createElement("div");
                titleFrame.classList.add("titleframe");
                titleFrame.style.cursor = "pointer";

                const closeBtn = document.createElement("img");
                closeBtn.src = "/data/ui/icons/cross.svg";
                closeBtn.style.float = "right";
                closeBtn.classList.add("btn", "black", "svgicon");
                closeBtn.addEventListener("click", () => newWindow.remove());
                titleFrame.appendChild(closeBtn);
                newWindow.appendChild(titleFrame);

                const updateHeader = document.createElement("h3");
                updateHeader.textContent = `Update KEK UI to Version ${data.tag_name}.`;
                updateHeader.classList.add("textprimary");
                newWindow.appendChild(updateHeader);

                const description1 = document.createElement("p");
                description1.textContent = "To complete the update, make sure to press the";
                newWindow.appendChild(description1);

                const description2 = document.createElement("p");
                description2.classList.add("textparty");
                description2.textContent = "Overwrite";
                newWindow.appendChild(description2);

                const description3 = document.createElement("p");
                description3.textContent = "button in Tampermonkey.";
                newWindow.appendChild(description3);

                const updateBtn = document.createElement("div");
                updateBtn.classList.add("btn", "green", "textblack");
                updateBtn.textContent = "Update Now";
                updateBtn.addEventListener("click", () => {window.open(data.assets[0].browser_download_url);window.location.href = "/"});
                newWindow.appendChild(updateBtn);

                layout.appendChild(newWindow);
            })
            .catch(error => {
                console.error("Error fetching data:", error);
            });
    }
}, 100);