User:Southparkfan/GS-delete.js

/* * Script that adds several global sysop delete and block reasons to action=delete and Special:Block forms * * Reasons provided by Mathonius and Trijnstel * Rewritten by User:Hoo man * * */ /* * Original link: http://meta.wikimedia.org/wiki/User:JurgenNL/GS_delete.js - original authors are Hoo man, Mathonius, Trijnstel and JurgenNL * Switches + Dutch translation by Southparkfan, CC-BY-SA */ /*global mw*/ $(document).ready(function {	"use strict";	if(mw.config.get('wgAction') !== 'delete' && mw.config.get('wgCanonicalSpecialPageName') !== 'Block') {		return;	}	// Creates the html for a containing the given reasons	function constructOptgroup( reasons ) {		var html = '';		for(var i = 0; i<reasons.length; i++) {			html += mw.html.element('option', {'value' : reasons[i]}, reasons[i]);		}		html += ' ';		return html;	}

switch(mw.config.get('wgLanguageCode')) { case 'default': // Reasons for both delete and block var additionalReasons = [ "Spam (global sysop action)", "Spambot (global sysop action)", "Vandalism (global sysop action)", ];	// Reasons for delete only var additionalDelete = additionalReasons.concat([			"No useful content (global sysop action)",			"Test page (global sysop action)",			"Nonsense (global sysop action)",			"Requested by the author (global sysop action)",			"Copyright violation (global sysop action)"		]); // Reasons for blocks only var additionalBlock = additionalReasons.concat([			"Intimidating behaviour/harassment (global sysop action)",			"Cross-wiki issues (global sysop action)",			"Rangeblock for spam - if blocked in error, please contact a sysop (global sysop action)",		]); break; case 'nl': // Reasons for both delete and block var additionalReasons = [ "Spam (global sysop actie)", "Spambot (global sysop actie)", "Vandalisme (global sysop actie)", ];	// Reasons for delete only var additionalDelete = additionalReasons.concat([			"Geen zinvolle inhoud (global sysop actie)",			"Gezandbak (global sysop actie)",			"Onzin (global sysop actie)",			"Op aanvraag van de auteur (global sysop actie)",			"Auteursrechtenschending (global sysop actie)"		]); // Reasons for blocks only var additionalBlock = additionalReasons.concat([			"Intimidatie/beledigingen (global sysop actie)",			"Cross-wiki problemen (global sysop actie)",			"Rangeblock vanwege spam - indien onterecht, neem contact op met een beheerder (global sysop actie)",       		]); break; }       break; }	if(mw.config.get('wgAction') === 'delete') { // Append reasons to action=delete $('#wpDeleteReasonList').append(constructOptgroup(additionalDelete)); } else { // Special:Block $('#mw-input-wpReason').append(constructOptgroup(additionalBlock)); // Unselect the block reason and put it into the "Other:" field $('form input[type=submit]').click(			function {				var blockReason = '';				if ( $('#mw-input-wpReason').val !== 'other' ) {					blockReason = $('#mw-input-wpReason').val;				}				if ( $('#mw-input-wpReason-other').val ) {					if ( blockReason ) {						blockReason += ': ';					}					blockReason += $('#mw-input-wpReason-other').val;				}				$('#mw-input-wpReason-other').attr('value', blockReason);				$('#mw-input-wpReason option').attr('selected', null);				$('#mw-input-wpReason option').eq(0).attr('selected', 'selected');			}		); } }); /* */