Jump to content

User:EstherLoer/distinguish title.js

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.
// This script turns the name of the "File:" name space grey and adds a gap between it and the file name.
	// Not compatible with other title-modifying scripts like hide_path.js .
	
var firstHeading = document.getElementById("firstHeading");

	// to select all name spaces, use: RLCONF.wgNamespaceNumber > 0
if (RLCONF.wgNamespaceNumber == 6 && RLCONF.wgAction == "view") {
	// generate new title
	firstHeading.innerHTML = 
    '<span style="color:grey;margin-right:1em;">'
  	+ firstHeading.innerHTML.substring(0,firstHeading.innerHTML.search(":")+1)
  	+ '</span>'+firstHeading.innerHTML.substring(firstHeading.innerHTML.search(":")+1);
}

// [[Category:Wikipedia scripts|distinguish_title]]