MediaWiki:Citizen.js

/* All JavaScript here will be loaded for users of the Citizen skin */ mw.loader.using( [ 'mediawiki.util' ] ).done( function {	/* HotCat fixer */	setTimeout(function{ x = document.getElementById("p-views").getElementsByTagName("ul")[0].children; if(x) for(i=0; i<x.length; i++) { if(x[i].innerText == "Edit" || x[i].innerText == "Edit source") x[i].id = "ca-edit"; }	}, 1000);

/* Disable toggling sections when edit */ x=document.getElementsByClassName("mw-editsection"); if(x) for(i=0; i<x.length; i++) { x[i].getElementsByTagName("a")[0].onclick = function(e){ e.stopPropagation; }; }	/* Collapsible TOC */ x=document.querySelectorAll(".toc li .tocnumber"); if(x) for(i=0; i<x.length; i++) { x[i].onclick = function(e){ y = this.parentElement.parentElement.getElementsByTagName("ul"); if(y.length) { if(y[0].style.display == "block") { y[0].style.display = "none"; y[0].parentElement.classList.add("collapsed"); } else { y[0].style.display = "block"; y[0].parentElement.classList.remove("collapsed"); }           }			e.stopPropagation; };	}	x=document.querySelectorAll(".toc li"); if(x) { for(i=0; i Beginning "; x.className = "toclevel-1"; document.querySelector(".toc ul").prepend(x); }   /* Sidebar menu shorter */ x=document.querySelectorAll("#p-managewiki-sidebar-header .mw-list-item a"); if(x) for(i=0; i<x.length; i++) { x[i].innerHTML = x[i].innerHTML.replace("this wiki's ", ""); } } );