User:Jasca Ducato/monobook.js

// // ================================================================================ // START Automated deletion button script system // ================================================================================ // Adds customizable one-click deletion buttons to any deletable page. addOnloadHook(checkdelete); function checkdelete { if(queryString("submitdelete")=="true") document.getElementById('deleteconfirm').wpConfirmB.click }

if(wgNamespaceNumber != -1) addOnloadHook(addDeleteButtons) function addDeleteButtons { if(!document.getElementById('ca-delete')) return var url=document.getElementById('ca-delete').firstChild.href //examples: addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Junk/vandalism') ,'j','ca-delete1'); addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Contained only an infobox') ,'oi','ca-delete2'); addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Unused') ,'u','ca-delete3'); addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Requested for deletion') ,'rq','ca-delete4'); addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Broken/unneeded redirect'),'rd','ca-delete5'); }

function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }  return null; }

// ================================================================================ // END Automated deletion button script system // ================================================================================ //