MediaWiki:PowerDelete.js

/////////////////////////////////////////////////////////////////////////////////// ///////////// PowerDelete - Recreates Staff/VSTF's PowerDelete right ////////////// /////////////                    Author: Doork                      ////////////// /////////////     Deletes and Protects pages/files in one click     ////////////// ///////////////////////////////////////////////////////////////////////////////////

var ug = mw.config.get('wgUserGroups'); if (ug.indexOf('sysop') + ug.indexOf('content-moderator') + ug.indexOf('vstf') + ug.indexOf('staff') + ug.indexOf('helper') > -5) { // Button Placement. var button = 'PowerDelete' $('.WikiaMenuElement').append(button);

// Function itself. function del{ var FormHTML = '\  \ \     Type of protection: \  \ Admin (edit) \ Admin (move) \ Admin (edit, move) \ Admin (edit, move, upload) \ Admin (create) \ Autoconfirmed (edit) \ Autoconfirmed (move) \ Autoconfirmed (edit, move) \ Autoconfirmed (edit, move, upload) \ Autoconfirmed (create) \ \     \      Expiry of protection: \  \ \     Reason of protection: \  \ \     Reason of delete: \ <input type="text" id="delete-reason" value="" /> \ \   \  ';      $.showCustomModal('PowerDelete', FormHTML, {      id: 'form-powerdel',      width: 500,      buttons: [{            message: 'Cancel',          handler: function {            $('#form-powerdel').closeModal;          }      }, {          id: 'startButton',          message: 'Do it',          defaultButton: true,          handler: function  {            realdel;           }      }]    }); } function realdel{ $.post(mw.util.wikiScript('api'), {               format: 'json',                action: 'protect',                expiry: $('#protect-type').val,                protections: $('#protect-expiry').val || $('#protect-expiry').attr('placeholder'),                watchlist: 'nochange',                title: wgPageName,                reason: $('#protect-reason').val,                token: mw.user.tokens.get("editToken")            }); $.post(mw.util.wikiScript('api'), {               format: 'json',                action: 'delete',                reason: $('#delete-reason').val,                title: wgPageName,                token: mw.user.tokens.get("editToken")            }); alert('Done!'); window.location.reload; }   }