SPlex.gg Attack-Hide and Sort

Add a button to remove protected targets and sort by max possible steal https://go.splex.gg/

by hive_coding

JavaScript

// ==UserScript==
// @name         SPlex.gg Attack-Hide
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Add a button to remove protected targets and sort by max possible steal  https://go.splex.gg/
// @author       louis88 + ChatGPT + Hive-coding
// @match        https://go.splex.gg/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Function for hiding Rows with the "protection_remove" class
    function hideDivsWithClass() {
        const divs = document.querySelectorAll('div.protection_remove');
        divs.forEach(div => {
            const tr = div.closest('tr');

            if (tr) {
                tr.style.display = 'none';
            }
        });

        sortTableByStealValue();
    }



    function sortTableByStealValue() {
        console.log("tablesort");
        var table = document.querySelector("table.go_menu_no_pad"); // Die Tabelle auswählen
        var rows = Array.from(table.querySelectorAll("tr.attack_lb")); // Alle Zeilen auswählen und in ein Array umwandeln

        // Die Zeilen sortieren
        rows.sort(function (a, b) {
            console.log(a,b);
            var spanA = a.querySelector(".lb_steal span"); // Das span-Element in der ersten Zeile
            var spanB = b.querySelector(".lb_steal span"); // Das span-Element in der zweiten Zeile
            var valueA = parseFloat(spanA.textContent); // Den Wert in der ersten Zeile extrahieren und in eine Fließkommazahl umwandeln
            var valueB = parseFloat(spanB.textContent); // Den Wert in der zweiten Zeile extrahieren und in eine Fließkommazahl umwandeln

            // Vergleiche die Werte und sortiere die Zeilen aufsteigend
            return valueB - valueA;
        });

        // Die sortierten Zeilen zur Tabelle hinzufügen
        var tbody = table.querySelector("tbody");
        rows.forEach(function (row) {
            tbody.appendChild(row);
        });
    }



    // Function to create the...