Reddit Sub Filter

Filter subs from r/all.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

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