User:Galwhaa/usergreeter.js

window.userGreeter=function(data, download) { var user=Title.fromURL(download.url).userName(true); var userName=String(user); userName = userName.replace(/User:/, ""); userName = userName.replace(/_/g, " "); if(!user) { return ''; } var lk=titledWikiLink({article: user.talkPage, action: 'edit', text: 'greet ' + userName}); var autoParams='autoedit=s#$#\n{'+'{subst:User:Galwhaa/Template:Welcome|'+userName+'}'+ '}%20'+'#&autosummary=Welcome!&autoclick=wpSave&autominor=true&autowatch=false'; return appendParamsToLink(lk, autoParams); } function installGreeter { window.old_getPageInfo=window.getPageInfo; window.getPageInfo=function(data,download) { return window.userGreeter(data,download) + ' ' + window.old_getPageInfo(data,download); } if (document.getElementsByTagName('h1')[0].innerHTML == "User creation log") { userGreeter2; } } addOnloadHook(installGreeter);

window.userGreeter2=function { userList = document.getElementsByTagName('ul')[0].getElementsByTagName('li'); for (i=0; i/, "").replace(/<.*/, ""); userSpan = userList[i];//.getElementsByTagName('span')[0]; spanText = userSpan.innerHTML; spanText = spanText.substr(0, spanText.length - 21) + '> | greet)'; userSpan.innerHTML = spanText; } }