User:TheFearow/public/newuserlogwelcome.js

//Config

//What template to welcome with if(!nulwTemplate){ var nulwTemplate = "W-screen"; } //What template to welcome anons with if(!nulwAnonTemplate){ var nulwAnonTemplate = "Welcome-anon"; }

// Code - DO NOT MODIFY BELOW HERE

importScript("User:TheFearow/qstring.js"); importScript("User:TheFearow/simpleajax.js");

addOnloadHook(initNewusers); function initNewusers{ if(wgPageName != "Special:Log" || !QueryString.get("type") == "newusers"){ return; } var list = document.getElementById('bodyContent').getElementsByTagName("A"); var ignore = [ ]; for(i = 0; i < list.length; i++){ link = list[i]; if(link == null){ continue; }  if(ignore.indexOf(link.title) != -1){ continue; }  if(link.parentNode.innerHTML.indexOf("created new account") != -1){ continue; }  if(link.className == "new"){ if(link.title.indexOf("User talk:") != -1){ link.innerHTML = "Welcome"; link.style.color = "blue"; ignore[ignore.length] = link.title; var orighref = link.href; var uname = link.title.replace("User talk:", ""); var template = nulwTemplate; var unameProcessed = uname.replace(".", "").replace(".", "").replace(".", ""); if(unameProcessed.length == (uname.length-3)){ template = nulwAnonTemplate; }    link.href = "javascript:ajaxwelcome('" + uname + "', 'subst:" + template + "')"; link.id = "welcomelink-" + uname; link.className = ""; link.parentNode.innerHTML = link.parentNode.innerHTML.replace(" | Talk | <a"); }  }  } }

function ajaxwelcome(username, template){ simpleAJAXEdit("User talk:"+username, "{"+"{"+template+"}}", "Welcome to Wikipedia!", false, false, " Welcoming user " + username + "... ", " User "+username+" welcomed! " ); document.getElementById('welcomelink-' + username).style.display = 'none'; }