AimIsADick Blocker 9000

Hides AimIsADick posts on teamfortress.tv website

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         AimIsADick Blocker 9000
// @description     Hides AimIsADick posts on teamfortress.tv website
// @include      *://*teamfortress.tv/*
// @include      *://*tf.gg/*
// @version 0.0.1.20210320153402
// @namespace https://greasyfork.org/users/749376
// ==/UserScript==

(function() {
    'use strict';
    var thread_container = document.getElementById("thread-container");
    if(thread_container) {
        var post_array = thread_container.getElementsByClassName("post");
        var remove_posts = [];
        for (let post of post_array) {
            if(post.querySelector(".post-header .post-author").innerHTML.includes("AimIsADick")) {
                remove_posts.push(post);
            }
        }
        while(remove_posts.length > 0) {
            let post = remove_posts.shift();
            if (!post.querySelector(".post-header .post-frag-container .minus").className.includes("clicked")) {
                fetch('/post/frag/'+post.id.replace(/[^\d]*/g,'')+'/minus');
            }
            post.parentNode.removeChild(post);
        }
    }
})();