Uit Hack42
< Gebruiker:Wimh
Versie door Wimh (overleg | bijdragen) op 8 sep 2022 om 10:15 (source: https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-blockoptions.js&oldid=531178744)
(wijz) ← Oudere versie | Huidige versie (wijz) | Nieuwere versie → (wijz)
Ga naar: navigatie, zoeken

Opmerking: nadat u de wijzigingen hebt opgeslagen is het wellicht nodig uw browsercache te legen.

  • Firefox / Safari: houd Shift ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
  • Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
  • Internet Explorer: houd Ctrl ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5
  • Opera: ga naar Menu → Instellingen (Opera → Voorkeuren op een Mac) en daarna naar Privacy & beveiliging → Browsegegevens wissen... → Tijdelijk opgeslagen afbeeldingen en bestanden.
function QuickBlock (blockOther,blockReason,anonOnly,createAccount,enableAutoblock,emailBan,hideName,watchUser,allowUsertalk) {
	blockForm = document.getElementById('blockip');
	inputs = blockForm.getElementsByTagName('input');
	for (i=0; i<inputs.length; i++) {
		if (inputs[i].name == 'wpBlockOther') {
			inputs[i].value = blockOther;
			continue;
		}
		if (inputs[i].name == 'wpBlockReason') {
			inputs[i].value = blockReason;
			continue;
		}
		if (inputs[i].name == 'wpAnonOnly') {
			if (anonOnly==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
		if (inputs[i].name == 'wpCreateAccount') {
			if (createAccount==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
		if (inputs[i].name == 'wpEnableAutoblock') {
			if (enableAutoblock==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
		if (inputs[i].name == 'wpEmailBan') {
			if (emailBan==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
		if (inputs[i].name == 'wpHideName') {
			if (hideName==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
		if (inputs[i].name == 'wpWatchUser') {
			if (watchUser==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
		if (inputs[i].name == 'wpAllowUsertalk') {
			if (allowUsertalk==1) {
				inputs[i].checked = true;
			}
			else {
				inputs[i].checked = false;
			}
			continue;
		}
	}
	blockForm.submit();
}

function userIsInGroup (group) {
//are they in a given local group?
	if (mw.config.get('wgUserGroups')) {
		if (!group || group.length == 0) group = '*';
		if (mw.config.get('wgUserGroups').join (' ').indexOf (group) != -1){
			return true;
		}
		else{
			return false;
		}
	}
	return false;
}
function userIsInGlobalGroup (group) {
//are they in a given global group?
	if (mw.config.get('wgGlobalGroups')) {
		if (!group || group.length == 0) group = '*';
		if (mw.config.get('wgGlobalGroups').join (' ').indexOf (group) != -1){
			return true;
		}
		else{
			return false;
		}
	}
	return false;
}

function addblockoptions() {//blockOther,blockReason,anonOnly,createAccount,enableAutoblock,emailBan,hideName,watchUser,allowUsertalk
	mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("31 hours","recent vandalism",0,1,0,0,0,0,1)',
		'vandal: 31h',
		'p-block-31h');
	mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 week","repeat vandalism",1,1,1,0,0,0,1)',
		'vandal: 1w',
		'p-block-week');
	mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 month","chronic vandalism",1,1,1,0,0,0,1)',
		'vandal: 1m',
		'p-block-month');
	mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","vandalism-only account",0,1,1,0,0,0,1)',
		'vandal: indef',
		'p-block-vandalism');
	mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("3 months","cross-wiki issues",0,1,1,1,0,0,0)',
		'xwiki: 3mo',
		'p-block-xwiki');
	mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 year","[[w:Open proxy|Open proxy]] or [[w:Zombie computer|zombie]] ([[m:WM:NOP|info]])",0,1,0,0,0,0,1)',
		'op',
		'p-block-proxy');
	if(userIsInGroup('checkuser')||userIsInGlobalGroup('steward')) mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","checkuserblock",0,1,1,1,0,0,0)',
		'checkuserblock-user',
		'p-block-cu-user');
	if(userIsInGroup('checkuser')||userIsInGlobalGroup('steward')) mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("1 year","checkuserblock",0,1,1,1,0,0,1)',
		'checkuserblock-IP',
		'p-block-cu-ip');
	if(userIsInGroup('oversight')||userIsInGlobalGroup('steward')) mw.util.addPortletLink('p-cactions',
		'javascript:('+QuickBlock+')("infinite","abusive user name",0,1,1,1,1,0,0)',
		'invisible',
		'p-block-invisible');
	//blockOther,blockReason,anonOnly,createAccount,enableAutoblock,emailBan,hideName,watchUser,allowUsertalk
}
if ( mw.config.get('wgCanonicalSpecialPageName') == 'Blockip' )$(addblockoptions);