MediaWiki:Fastdelete.js

// assistance from Doru, Kocka, Becasita, Stjn var ug = mw.config.get("wgUserGroups"); var skin = ((mw.config.get('skin') === 'monobook') || (mw.config.get('skin') === 'vector'));
 * (function($, mw) {

if ( (ug.indexOf('AW-Staff') + ug.indexOf('CVU') + ug.indexOf('Administrator')) > -3 && skin){ if ($("#t-fd").length > 0) {return;} else { $.when( mw.loader.using( 'mediawiki.util' ), mw.loader.using( 'mediawiki.api' ), $.ready ).then( function { 				mw.util.addPortletLink('p-tb', '#', "FastDelete", 't-fd');				$('#t-fd').click(function  { var reason = prompt("Reason to delete"); if (!reason) { reason = prompt('Enter reason'); }					else { if (confirm("confirm you wish to delete?")) { fastdelete(reason); }						else { return; }					}				});				function fastdelete(deleteReason) {					var Api = new mw.Api;					var token = mw.user.tokens.get('csrfToken');					Api.post({ action: 'delete', title: mw.config.get("wgPageName"), reason: deleteReason, token: token }).done(function { location.reload });				}			} );		}	} }) (this.jQuery, this.mediaWiki);