Universal Hub Killfile

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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