/* == Username replace function ==
* Inserts user name into <span class="insertusername"></span>
* Originally by [[uncyclopedia:User:Splaka|Splaka]], updated by same.
* disable with: var disableUsernameReplace = true;
*/
function UsernameReplace() {
if(window.disableUsernameReplace || wgUserName == null) return;
var un = getElementsByClassName(document, 'span', 'insertusername');
for (var i=0;i<un.length;i++) {
var d = 0;
for(var j=0;j<un[i].childNodes.length;j++) {
if(un[i].childNodes[j].nodeType == 3 && d < 1) {
//find first text node and replace;
un[i].childNodes[j].nodeValue = wgUserName;
d++;
}
}
}
}
$(UsernameReplace);