MediaWiki:Common.js

From BGBM Collection Workflows
Revision as of 09:26, 10 July 2018 by DavidFichtmueller (talk | contribs) (added easy account approval for admins)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */


//easy account approval for admins
if(mw.config.get("wgUserGroups").includes("sysop")){
	if(mw.config.get("wgPageName")=="Special:ListUsers" || mw.config.get("wgPageName")=="Special:ActiveUsers"){
		var linkMenues = document.getElementById("mw-content-text").getElementsByClassName("mw-usertoollinks")
		for(i=0;i<linkMenues.length;i++){
			var linkMenu = linkMenues[i];
			var editRightsLink = linkMenu.lastElementChild.cloneNode(true);
			editRightsLink.href = editRightsLink.href.replace("Special:Block","Special:UserRights");
			editRightsLink.title = editRightsLink.title.replace("Special:Block","Special:UserRights");
			editRightsLink.innerHTML = "edit rights";
			linkMenu.insertBefore(document.createTextNode(" | "), linkMenu.lastChild);
			linkMenu.insertBefore(editRightsLink, linkMenu.lastChild);
		}
	}else if(mw.config.get("wgPageName").indexOf("Special:UserRights/")===0){
		var gfbioUserCheckbox = document.getElementById("wpGroup-gfbioUser");
		if(!gfbioUserCheckbox.checked){
			gfbioUserCheckbox.checked = true;
			var inputReason = document.getElementById("wpReason");
			inputReason.value = "is part of the GFBio Team";
	 
			var label = gfbioUserCheckbox.nextElementSibling;
			label.innerHTML = label.innerHTML + " <i>(auto selected by script)</i>"; 
			label.setAttribute("style","background:#8f8;")
		}
	}
}