Hide ill posts

Let sunshine take over Huasing!

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Hide ill posts
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Let sunshine take over Huasing!
// @author       Nevermoi
// @match        http://bbs.huasing.*/sForum/*.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var banList = ['HitmanYK'];

    for(var i = 0; i < banList.length; i++) {
        killThemAll(banList[i]);
        killThemAllInPost(banList[i]);
    }

    function killThemAll(name) {
        var them = $("div.ccol6 a[title="+ name +"]");
        var targets = [];
        for(var i = 0; i < them.length; i++) {
            var parents = $(them[i]).parents();
            //by inspecting dom, the 3rd element is div.brow2
            targets.push(parents[2]);
        }

        for(var j = 0; j < targets.length; j++) {
            $(targets[j]).hide();
        }
    }
    
    function killThemAllInPost(name) {
        var themTitles = $("div.authordiv:contains('" + name + "')");

        for (var i = 0; i < themTitles.length; i++) {
            // hide title by name
            $(themTitles[i]).hide();

            // get content id
            var contentId = "#" + themTitles[i].id.replace('auth', 'content');

            // hide content by id
            $(contentId).hide();
        }
    }
})();