From Wikipedia, the free encyclopedia
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.

// <syntaxhighlight lang=javascript>

var lang = new Array(

	'[[WP:VAND|Vandalism]]-only account',

	'[[WP:3RR|Three-revert rule]] violation',

	'[[WP:EW|Edit warring]]',

	'Abusing [[WP:SOCK|multiple accounts]]',

	'{{' + 'blocked proxy}}',

	'{{' + 'tor}}',

	'{{' + 'zombie proxy}}',

	'{{' + 'UsernameBlocked}}',

	'{{' + 'UsernameHardBlocked}}'

);

function blockaux()

{

	var bl = document.getElementById('wpBlockReasonList');

	var be = document.getElementById('wpBlockExpiry');

	switch (bl.value)

	{

		case lang0:

		case lang3:

		case lang8:

			blockparam(true, true, true, true, false, false);

			break;

		case lang1:

		case lang2:

			var temp = prompt('On', '');

			document.getElementById('mw-bi-reason').value = (temp == null ? '' : 'on [[' + temp + ']]');

		default:

			blockparam(false, true, true, true, false, false);

			break;

		case lang4:

		case lang5:

		case lang6:

			blockparam(false, false, true, true, false, true);			

			break;

		case lang7:

			blockparam(true, true, false, false, false, false);

			break;

	}

}

function blockparam(indef, ao, ac, ab, em, proxy)

{

	var bo = document.getElementById('wpBlockOther');

	var tp1 = '<td align="right"><label for="mw-bi-other">Other time:</label></td><td><input name="wpBlockOther" size="45" value="';

	var tp2 = '" tabindex="3" id="mw-bi-other"></td>';

	if (indef)

	{

		document.getElementById('wpBlockExpiry').value = 'other';

		bo.innerHTML = tp1 + 'infinite' + tp2;

	}

	else if (proxy)

	{

		document.getElementById('wpBlockExpiry').value = 'other';

		bo.innerHTML = tp1 + '3 years' + tp2;

	}

	document.getElementById('wpAnonOnly').checked = ao;

	document.getElementById('wpCreateAccount').checked = ac;

	document.getElementById('wpEnableAutoblock').checked = ab;

	document.getElementById('wpEmailBan').checked = em;

	considerChangingExpiryFocus();

}

addOnloadHook(function()

{

	if (document.getElementById('wpBlockReasonList'))

	{

		var bl = document.getElementById('wpBlockReasonList');

		bl.parentNode.innerHTML = '<select tabindex="4" id="wpBlockReasonList" name="wpBlockReasonList" onchange="blockaux();"></select>';

		var bl = document.getElementById('wpBlockReasonList');

		var rsn = new Array(

			new Array('other', 'Other reason'),

			new Array('[[WP:VAND|Vandalism|Vandalism]]', 'Vandalism'),

			new Array(lang0], 'VOA'),

			new Array(lang1], '3RR'),

			new Array(lang2], 'Edit warring'),

			new Array(lang3], 'Sockpuppetry'),

			new Array('Attempting to [[WP:HAR|harass]] other users', 'Harassment'),

			new Array('Creating [[WP:PN|nonsense]] pages', 'Creating nonsense'),

			new Array('Inserting [[WP:V|unverifiable]] information', 'Unveriable info'),

			new Array('[[WP:SPAM|Spamming]] links to external sites', 'Spamming'),

			new Array('Repeated violations of [[WP:C|copyright policy]]', 'Copyvio'),

			new Array('{{' + 'anonblock}}', 'Anon block'),

			new Array('{{' + 'schoolblock}}', 'School'),

			new Array(lang4], 'Proxy'),

			new Array(lang5], 'Tor'),

			new Array(lang6], 'Zombie'),

			new Array(lang7], 'Username'),

			new Array(lang8], 'Username hardblock')

		);

		for (i = 0; i < rsn.length; i++)

		{

			var bl_new = document.createElement('option');

			bl_new.text = rsni][1];

			bl_new.value = rsni][0];

			bl.add(bl_new, null);

		}

	}

});

// </syntaxhighlight>