User:Kanegasi/pendingdeletion.js

$('#n-portal').before('').html('Delete pages (?)').attr({   id: 't-pendingdeletion', style: 'cursor:pointer', title: 'Click to query pending deletions' }); $('#t-pendingdeletion').click(function pdclicked {   $.ajax({ type: "GET", url: mw.util.wikiScript('api'), data: { format: 'json', action: 'query', list: 'categorymembers', cmtitle: 'Category:Pending deletion', cmlimit: 'max' },       async: true, success: function pdresponse(catResponse) { var taggedPages = 0; for (var page in catResponse.query.categorymembers) { taggedPages += 1; }           if (taggedPages > 0) { $('#t-pendingdeletion').text('DELETE PAGES (' + taggedPages + ')').attr({                   href: 'http://www.minecraftwiki.net/wiki/Category:Pending_deletion',                    style: 'font-weight:bold',                    title: 'Go to Category:Pending deletion'                }); } else { $('#t-pendingdeletion').text('Delete pages (0)'); }       }    }); });