Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Comment purge
- // @version 1.0.1
- // @author Manish Goregaokar (http://stackapps.com/users/10098/manishearth)
- // @description One-click comment purges
- // @license GNU GPL v3 (http://www.gnu.org/copyleft/gpl.html)
- // @include http://*stackoverflow.com/*
- // @include http://*superuser.com/*
- // @include http://*serverfault.com/*
- // @include http://*stackexchange.com/*
- // @include http://discuss.area51.com/*
- // ==/UserScript==
- function with_jquery(f) {
- var script = document.createElement("script");
- script.type = "text/javascript";
- script.textContent = "(" + f.toString() + ")(jQuery)";
- document.body.appendChild(script);
- };
- with_jquery(function($){
- $('document').ready(function(){
- var htm=$('.post-menu').html()||"";
- if(htm!=-1&&$('[id^=close-question] span').length!=0){
- return;
- }
- $('.post-menu').append($('<span class="lsep">|</span><a class="purge" href="javascript:void(0)" title="Purge comments">purge</a>'));
- $('.purge').bind("click",function(){
- var postid=$(this).closest('div.question,div[id^=answer]').data('questionid')||$(this).closest('div.question,div[id^=answer]').data('answerid');
- $.post('/admin/posts/'+postid+'/delete-comments',{'mod-actions':'delete-comments',
- 'duration':1,
- 'target-post-id':postid,
- 'fkey':StackExchange.options.user.fkey});
- return false;
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement