Universal Hub Killfile

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

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        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;
});