Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
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.
// 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 {varrealTitleBanner=document.getElementById("RealTitleBanner");if(realTitleBanner&&!document.getElementById("DisableRealTitle")){varrealTitle=document.getElementById("RealTitle");if(realTitle){realTitle=realTitle.innerHTML;// TODO: replace this with something like "realText"varisPasteable=0;// calculate whether the title is pasteablevarverifyTitle=realTitle.replace(/^ +/,"");// trim left spacesverifyTitle=verifyTitle.replace(/ /g,"_");// spaces to underscoresverifyTitle=verifyTitle.charAt(0).toUpperCase()+verifyTitle.substring(1,verifyTitle.length);// uppercase first characteralert("1. '"+verifyTitle+"'");// if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.if(wgNamespaceNumber!=0){if(wgCanonicalNamespace==verifyTitle.substr(0,wgCanonicalNamespace.length)&&verifyTitle.charAt(wgCanonicalNamespace.length)==":"){verifyTitle=verifyTitle.substr(wgCanonicalNamespace.length+1);}else{realTitle=wgCanonicalNamespace.replace(/_/g," ")+":"+realTitle;}}alert("2a. '"+verifyTitle+"'");alert("2b. '"+realTitle+"'");// verify whether wgTitle matchesverifyTitle=verifyTitle.replace(/^_+/,"").replace(/_+$/,"");// trim left and right spacesverifyTitle=verifyTitle.charAt(0).toUpperCase()+verifyTitle.substring(1,verifyTitle.length);// uppercase first characterisPasteable=(verifyTitle==wgTitle);alert("3. '"+verifyTitle+"' == '"+wgTitle+"' => "+isPasteable);varh1=document.getElementsByTagName("h1")[0];if(h1&&isPasteable){h1.innerHTML=realTitle;realTitleBanner.style.display="none";}document.title=realTitle+" - Wikipedia, the free encyclopedia";}}//} catch (e) {/* Something went wrong. *///}});