Torn - Hide noob forum posts

Hide forum posts from noobs

// ==UserScript==
// @name         Torn - Hide noob forum posts
// @namespace    Titanic_
// @version      1.0
// @description  Hide forum posts from noobs
// @license      MIT
// @author       Titanic_ [2968477]
// @match        https://www.torn.com/forums.php*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=torn.com
// @grant        none
// ==/UserScript==

const hideAbove = 3100000

function main() {
    const threads = document.querySelectorAll(".threads-list > li:not(.tt-forums-hidden)");

    threads.forEach(thread => {
        const a = thread.querySelector(".starter > a");
        const userId = a.getAttribute("href").split("=")[1];

        if(userId && userId >= hideAbove) {
            thread.style.display = "none";
        }
    });
}

const observer = new MutationObserver(() => {
    if (window.location.href.includes("p=forums")) {
        main();
    }
});

observer.observe(document.body, { childList: true, subtree: true });