User:Jcrook1987/welcome.js

// window.onload = Main; function Main { addactions; } function addactions { addwelcome; } function addwelcome { if(!document.editform) return; var txt = document.editform.wpTextbox1; var url = window.location; if(txt.value.length == 0) { if (url.search.indexOf("User_talk:") != -1) { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing") == 0) addlilink(tabs, 'javascript:welcome', 'welcome', 'ca-welcome'); } } } function welcome { document.editform.wpSummary.value = 'Welcome!'; document.editform.wpMinoredit.checked = false; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += 'Jcrook1987 --~'; document.editform.wpSave.focus; } function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); tabs.appendChild(li); return li; } //