Skip to content

Instantly share code, notes, and snippets.

@tghw
Created April 3, 2009 20:39
Show Gist options
  • Select an option

  • Save tghw/89953 to your computer and use it in GitHub Desktop.

Select an option

Save tghw/89953 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Remove viewed stories & block domains
// @namespace nothing
// @include http://reddit.com/*
// @include http://*.reddit.com/*
// ==/UserScript==
var site_blacklist = /imgur.com|holytaco.com/ig;
function main()
{
$('head').append('<style type="text/css">a:visited{z-index:666;}</style>');
//perform action on visited links
$('.entry > .title a').each(function() {
if($(this).css('zIndex') == '666')
{
$(this).parents('.thing').css({opacity: 0.5, backgroundColor: 'white'});
}
if($(this).parent().find('.domain').text().match(site_blacklist))
{
$(this).parents('.thing').remove();
}
});
$('.entry > .title a').mousedown(function(){
$(this).parents('.thing').css({opacity: 0.5, backgroundColor: 'white'});
});
}
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; main(); }
}
GM_wait();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment