User:Kanegasi/pendingdeletion.js

var $pendingDeletion = $('Delete pages (?)').attr({   id: 't-pendingdeletion',    href: '#',    title: 'Click to query pending deletions' }); $('#n-portal').before($('').html($pendingDeletion)); $('#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)'); }       }    }); });