Difference between revisions of "MediaWiki:Common.js"

From BGBM Collection Workflows
Jump to: navigation, search
(added easy account approval for admins)
(No difference)

Revision as of 09:26, 10 July 2018

/* 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;")
		}
	}
}