Universal Hub Killfile

Filters out posts on universalhub.com by users who are known to argue in bad faith.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name        Universal Hub Killfile
// @description Filters out posts on universalhub.com by users who are known to argue in bad faith.
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @include     http*://*universalhub.com/*
// @version     1.02
// @namespace https://greasyfork.org/users/41970
// ==/UserScript==

var usernameList = [
    "O-FISH-L",
    "Markk02474",
    "StillFromDorchester",
    "bosguy22",
    "Republican",
    "Doug1001"];

var curIdIndex = 0;
$('div[class="comment clearfix"]').filter(function(idx) {

    var authorUrl = $(this).find('.username')[0].toString();
    // If this is a registered user, we now have a handle to their full
    // profile page.  Otherwise we have an object that swe need to pull the
    // first child out of
    var author;
    if (authorUrl.indexOf("http://www.universalhub.com/users") != -1) {
        author = authorUrl.substring(34);
    } else {
        author = $(this).find('.username')[0].innerHTML;
    }
    for (var ii = 0; ii < usernameList.length; ii++) {
        if (author.toLowerCase().indexOf( usernameList[ii].toLowerCase() ) > -1) {
            var curUser = usernameList[ii].toLowerCase();
            curIdIndex++;
            // Hide the title div
            $(this).prev().css("display", "none");
            $(this).prev().attr("id", "title_" + curIdIndex);

            // Swap out the offending text
            $(this).attr("id", "comment_" + curIdIndex);
            $(this).html("<div>Hid comment by " + usernameList[ii] + "</div>");

            // Check to see if the following section is indented below this one, which
            // indicates that it's a response.  If so, hide it as well.
            if (typeof $(this).next().attr("class") != "undefined") {
                var classList = $(this).next().attr("class").split(/\s+/);
                for (var i = 0; i < classList.length; i++) {
                    if (classList[i] === 'indented') {
                        $(this).next().css("display", "none");
                        $(this).next().attr("id", "indent_" + curIdIndex);
                    }
                }
            }
            return true;
        }

    }
    return false;
});