User:Interiot/js/RealTitle.js

This is an old revision of this page, as edited by Interiot (talk | contribs) at 06:44, 16 November 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
// copied from http://fr.wikipedia.org/w/index.php?title=-&action=raw&gen=js

// The function looks for a banner like that:
// <div id="RealTitleBanner">Div that is hidden
//   <span id="RealTitle">title</span>
// </div>
// An element with id=DisableRealTitle disables the function.
addOnloadHook(function() {
	try {
		var realTitleBanner = document.getElementById("RealTitleBanner");
		if (realTitleBanner) {
			if (!document.getElementById("DisableRealTitle")) {
				var realTitle = document.getElementById("RealTitle");
				var h1 = document.getElementsByTagName("h1")[0];
				if (realTitle && h1) {
					h1.innerHTML = realTitle.innerHTML;
					realTitleBanner.style.display = "none";
				}
			}
		}
	} catch (e) {
		/* Something went wrong. */
	}
});