Created
January 9, 2013 04:44
-
-
Save justinwoo/4490644 to your computer and use it in GitHub Desktop.
Filters out unwanted subreddits from /r/all. Userscripts page: http://userscripts.org/scripts/show/156068
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Subreddit filter for /r/all | |
// @namespace http://www.github.com/kimagure | |
// @description Filters out unwanted subreddits from /r/all | |
// @include http://www.reddit.com/r/all* | |
// ==/UserScript== | |
bannedwords = [ | |
'porn', | |
'craft' | |
]; | |
horriblesubreddits = [ | |
'trees', | |
'wtf', | |
'politics', | |
'gonewild', | |
'todayilearned', | |
'4chan', | |
'pokemon', | |
'reactiongifs', | |
'fffffffuuuuuuuuuuuu', | |
'atheism', | |
'adviceanimals', | |
'firstworldanarchists', | |
'ImGoingToHellForThis', | |
'TwoXChromosomes', | |
'mildlyinteresting', | |
'nsfw', | |
'gentlemanboners', | |
'RealGirls' | |
]; | |
function DeleteorNot(word) { | |
if (horriblesubreddits.indexOf(word) != -1) | |
return true; | |
for (var n = 0; n < bannedwords.length; n++) { | |
if (word.search(bannedwords[n]) != -1) | |
return true; | |
} | |
return false; | |
} | |
function main() { | |
var elements = document.getElementsByClassName("link"); | |
for (var i = 0; i < elements.length; i++) { | |
subreddit = elements[i].getElementsByClassName("subreddit"); | |
if (subreddit[0] != null) { | |
var word = subreddit[0].innerHTML; | |
DeleteorNot(word) ? elements[i].outerHTML = '' : ''; | |
} | |
} | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment