DrDoof / Real Ignore User

// ==UserScript==
// @name         Real Ignore User
// @version      1337
// @description  Remove the posts of users you ignore completely and not just hide it.
// @author       DrDoof
// @license      MIT
// @match        *://hackforums.net/showthread.php?*
// @match        *://hackforums.net/usercp.php?action=editlists
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

const replacements = ['rattle', 'nonsense', 'literal trash', 'blah blah', 'gibberish', 'yada yada'];

GM_addStyle('.ignored_post{display:none;}');

(function() {
    if (-1 < window.location.href.indexOf("editlists")) {
        let ignoredUsers = [];
        document.querySelectorAll('#ignore_list span').forEach(e => ignoredUsers.push(e.innerText));
        GM_setValue('ignoredUsers', ignoredUsers);
    } else {
        let ignoredUsers = GM_getValue('ignoredUsers');
        if (ignoredUsers !== undefined) {
            let regex = /\)(.*).{7}$/;
            let citations = document.querySelectorAll('.mycode_quote > cite');
            citations.forEach(e => {
                let data = e.innerText.trim().match(regex);
                if (data !== null)
                    if (ignoredUsers.includes(data[1]))
                        e.parentElement.innerHTML = `<cite>${e.innerHTML}</cite>${randomReplacement()}`;
            });
        } else
            console.log("Ignored users hasn't been fetched yet");
    }
})();

function randomReplacement() {
    return replacements[Math.floor(Math.random() * replacements.length)];
}