Created
August 29, 2009 11:02
-
-
Save jartur/177459 to your computer and use it in GitHub Desktop.
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
// Tested with Opera only! | |
// | |
// ==UserScript== | |
// @name reddit sfw | |
// @description Removes reddits from /r/nsfw & with [NSFW] tag in title | |
// @include http://www.reddit.com/* | |
// ==/UserScript== | |
var items = document.getElementsByClassName("thing"); | |
for (i=0; i < items.length; i++) | |
{ | |
if(items[i].tagName.match(/div/i)) | |
{ | |
var remove = false; | |
// Check based on url | |
var els = items[i].getElementsByClassName("comments"); | |
if(els.length > 0) | |
{ | |
if(els[0].href && els[0].href.match(/nsfw/)) | |
{ | |
remove = true; | |
} | |
} | |
// Check based on title | |
els = items[i].getElementsByClassName("title"); | |
if(els.length > 0) | |
{ | |
if(els[0].innerText && els[0].innerText.match(/nsfw/i)) | |
{ | |
remove = true; | |
} | |
} | |
// Hide it | |
if(remove) | |
{ | |
items[i].style.display = "none"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment