MediaWiki:Common.js

/** Username replace function (Template:USERNAME) ******************************* * Inserts user name into * Originally by Splarka * New version by Spang */ function UserNameReplace { if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return; var n = YAHOO.util.Dom.getElementsByClassName('insertusername', 'span', document.getElementById('bodyContent')); for ( var x in n ) { n[x].innerHTML = wgUserName; } } addOnloadHook(UserNameReplace);

/** Title rewrite ******************************************************** * Rewrites the page's title, used by Template:Title * By Sikon */ function rewriteTitle {   if(typeof(SKIP_TITLE_REWRITE) != 'undefined' && SKIP_TITLE_REWRITE) return; var titleDiv = document.getElementById('title-meta'); if(titleDiv == null || titleDiv == undefined) return; var cloneNode = titleDiv.cloneNode(true); var firstHeading = document.getElementById('firstHeading'); var node = firstHeading.childNodes[0]; // new, then old! firstHeading.replaceChild(cloneNode, node); cloneNode.style.display = "inline"; var titleAlign = document.getElementById('title-align'); firstHeading.style.textAlign = titleAlign.childNodes[0].nodeValue; } YAHOO.util.Event.onDOMReady(rewriteTitle);