Hide ATS Trolls Comments

Hide ATS Troll Comments

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Hide ATS Trolls Comments
// @version      1.1.0
// @author       metalynx
// @include      https://www.abovetopsecret.com/*
// @grant        none
// @license      MIT
// @namespace https://greasyfork.org/users/911202
// @description Hide ATS Troll Comments
// ==/UserScript==

(function() {

    //Enter the ATS Trolls user names below. Values must be comma separated and enclosed in quotes as shown below.
    const _ATS_TROLLS = ['PatriotGames4u', 'BernnieJGato'];

    try {

        const t = document.querySelectorAll('.threadpost');
        if (t) {
            for (let k = 0; k < t.length; k++) {
                if (t[k].className === "threadpost flexDisplay") {
                    if (t[k].children.length > 1) {
                        if (t[k].children[1].className === 'miniprofile') {
                            if (t[k].children[1].children) {
                                if (_ATS_TROLLS.indexOf(t[k].children[1].children[0].innerText) !== -1) {
                                    let d = document.getElementById(t[k].id);
                                    d.hidden = true;
                                    d.style.visibility = 'hidden';
                                    d.remove();
                                }
                            }
                        }
                    }
                } else {
                    if (t[k].childNodes) {
                        if (t[k].childNodes[1].childNodes) {
                            if (_ATS_TROLLS.indexOf(t[k].childNodes[1].childNodes[1].innerText) !== -1) {
                                t[k].hidden = true;
                            }
                        }
                    }
                }

            }
        }

    } catch(e) {
        console.log('Hide ATS Trolls Comments Error', e);
    }

})();