User:Technical 13/SandBox/SpamUNblocker.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* See also: [[User:Technical 13/SandBox/G11user.js]] */
/* <nowiki> Start of script */

var SPAMblocker = mw.util.addPortletLink(
	'p-cactions',
	'#',
	'SPAMblock',
	'pt-spamblock',
	'Delete page as spam, block account, notify editor on talk page.',
	null,
	null
);
$( SPAMblocker ).click( function ( e ) {
	e.preventDefault();
	/* Open Special:Delete to delete page. */
	window.open(mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + mw.config.get('wgPageName') + '&action=delete&wpDeleteReasonList=%5B%5BWP%3ACSD%23G11%7CG11%5D%5D%20Unambiguous%20%5B%5BWP%3ANOTADVERTISING%7Cadvertising%5D%5D%20or%20promotion#firstHeading', "_blank");
 
	/* Open User_talk: to notify user */
	window.open(mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=User_talk%3A' + mw.config.get('wgTitle') + '&action=edit&section=new&preload=User:' + mw.config.get('wgUserName').replace(" ", "_") + '/SpamUNblocker&nosummary=1&minor=0&wpWatchthis=1&preview=yes#editform', "_blank");
 
	/* Open Special:Block to block user */
	window.open(mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=Special:Block/' + mw.config.get('wgTitle') + '&wpExpiry=infinite&wpReason=%7B%7Bspamusernameblock%7D%7D#firstHeading', "_blank");
});
 
/* Add a function to resize wpTextbox1 to 5 rows so the preview is shown */
if(mw.config.get('wgNamespaceNumber') === 3 && mw.config.get('wgAction') === "edit" && document.location.href.contains('&action=edit&section=new&preload=User:' + mw.config.get('wgUserName').replace(" ", "_") + '/SpamUNblocker&nosummary=1&minor=0&wpWatchthis=1&preview=yes') === true){
	$('#wpTextbox1').attr('rows','5');
}
 
/* End of script </nowiki> */