Skip to content

Instantly share code, notes, and snippets.

@TheEnigmaBlade
Created October 23, 2013 00:38
Show Gist options
  • Save TheEnigmaBlade/7110612 to your computer and use it in GitHub Desktop.
Save TheEnigmaBlade/7110612 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Reddit - redditremove://* button
// @include *://reddit.com/*
// @include *://*.reddit.com/*
// @version 1.0
// @run-at document-start
// ==/UserScript==
function addRemovalButtons() {
reason = 'just_because';
//Add the button to the end of each post listing
$('body.moderator div.thing').each(function(){
thing_id = $(this).attr('data-fullname');
entry = $(this).children('div.entry').first();
subreddit = $(entry).attr('subreddit');
$(entry).find('ul.flat-list.buttons').append('<li> \
<a href="redditremove://'+subreddit+'/'+thing_id+'/'+reason+'">remove with reason</a> \
</li>');
});
}
//Add the script to the page
document.addEventListener('DOMContentLoaded', function(e) {
var s = document.createElement('script');
s.textContent="("+addRemovalButtons.toString()+')();';
document.head.appendChild(s);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment