Untitled

 avatar
unknown
plain_text
a year ago
2.6 kB
5
Indexable
// ==UserScript==
// @name         MazeHost Admin
// @namespace    https://game.maze-host.ru/admin/
// @version      1.0
// @description  try to take over the world!
// @author       DManik
// @match        https://game.maze-host.ru/*
// @icon         https://game.maze-host.ru/favicon.ico
// @require      https://game.maze-host.ru/application/public/js-core/sweetalert.min.js
// @grant        none
// ==/UserScript==

(function() {

    var loading = false;

    function editGame() {

        if (loading === true) return 1;

        if (!document.location.href.includes('https://game.maze-host.ru/admin/services')) return 1;

        if (![...document.querySelectorAll('.table > tbody:nth-child(2) > tr > td:nth-child(3)')].some(element => element.textContent.includes('\n[]'))) return 1;

        var h3 = document.querySelector(".content-box-header");
        if (!h3 || !h3.textContent.includes("Все заказы услуг")) return 1;


        var table = document.getElementsByClassName('table')[0];

        if (table) {

            loading = true;

            const options = {
                method: 'POST',
                headers: {
                    'Cookie': "uid_maze=кука; PHPSESSID=кука;",
                    'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0",
                    'Connection': 'keep-alive',
                    'Referer': 'https://game.maze-host.ru/admin/',
                },
            };
            fetch('https://game.maze-host.ru/admin/servers/GetData', options)
                .then(response => response.json())
                .then(data => {
                var info = {}, modes = {'SA:MP': 'SA:MP', 'CR:MP': 'CR:MP', 'MTA': 'MTA', 'Counter Strike 1.6': 'CS 1.6', 'Counter Strike: Source': 'CS:S', 'VCMP': 'VC:MP'};
                data.data.map(el => (info[el[0]] = modes[Object.keys(modes).find(key => el[3].includes(key))]) && 1);

                [...document.querySelectorAll('.table > tbody:nth-child(2) > tr > td:nth-child(3)')].map((server) => {
                    if (!server.textContent.includes('\n[]')) return 1;
                    server.innerHTML = '<a href="/admin/servers/control/index/' + server.textContent.match(/(\d+)/)[0] + '">' + server.textContent.match(/#(\d+)/)[0] + '\n<span style="color: coral">[' + info[server.textContent.match(/#(\d+)/)[0]] + ']</span></a>';
                });
                loading = false;
            })





        }
    }

    editGame();
    setInterval(() => editGame(), 100);

})();
Editor is loading...
Leave a Comment