Reddit Sub Filter

Filter subs from r/all.

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        Reddit Sub Filter
// @namespace   http://*.reddit.*/r/all*
// @version     1.023
// @grant       none
// @description:en Filter subs from r/all.
// @description Filter subs from r/all.
// @include     https://*.reddit.*/r/all*
// @include     http://*.reddit.*/r/all*
// ==/UserScript==

// This list based on: https://gist.github.com/kimagure/4490644
// Edit to your Reddit preferences.
horriblesubreddits = [
	'trees',
	'wtf',
//	'politics',
//	'gonewild',
//	'todayilearned',
//	'4chan',
//	'pokemon',
//	'reactiongifs',
//	'fffffffuuuuuuuuuuuu',
//	'atheism',
//	'adviceanimals',
	'firstworldanarchists',
	'ImGoingToHellForThis',
	'TwoXChromosomes',
//	'mildlyinteresting',
//	'nsfw',
	'gentlemanboners',
//	'RealGirls',
	'creepy',
    'The_Donald',
    'cringepics',
    'niceguys',
    'natureismetal',
    'justneckbearthings',
    'lifeprotips',
];

var shitty_subs = document.getElementsByClassName("subreddit");

for (var i = shitty_subs.length - 1; i > -1; i--) {
	var url = shitty_subs[i].href.toLowerCase();

	for (var j = 0; j < horriblesubreddits.length; j++) {
		if (url.indexOf(horriblesubreddits[j].toLowerCase()) != -1) {
			//shitty_subs[i].parentNode.parentNode.parentNode.remove(); // Uncomment this line and comment or remove the next 4 lines to hide the post completely

            /*
            shitty_subs[i].parentNode.parentNode.children[0].children[0].innerHTML = "{CENSORED}";
			shitty_subs[i].parentNode.parentNode.children[0].children[0].style["font-weight"] = "bold";
            shitty_subs[i].parentNode.parentNode.children[0].children[0].href = "";
			shitty_subs[i].parentNode.parentNode.parentNode.children[3].href = "";
            */
            
//            console.log(shitty_subs[i].parentNode.parentNode.children[0].children[0]);
            
            var a = document.createElement('a');
            a.innerHTML = "{CENSORED}";
            a.style["font-weight"] = "bold";
            a.style["color"] = "#551a8b";
            a.href = "";
            
            shitty_subs[i].parentNode.parentNode.children[0].insertBefore(a, shitty_subs[i].parentNode.parentNode.children[0].children[1]);
            shitty_subs[i].parentNode.parentNode.children[0].children[0].remove();
            
            /*
            // Code to fix Reddit restoring the blocked link
            var link = shitty_subs[i].parentNode.parentNode.children[0].children[0];
            var clone = link.cloneNode(true);
            link.parentNode.replaceChild(clone, link);
            */
		}
	}
}