User:Lifebaka/welcome.js

//Adds a tab titled "welcome" to the top of user talk pages when editing //Clicking on "welcome" tab adds my welcome message to the page //and "welcome!" to the edit summary //written by User:Lifebaka, modified from WikiProject User scripts/Scripts/CloseAFD.js written by User:Johnleemk //to use this code, simply add importScript('User:Lifebaka/welcome.js'); to your monobook.js or vector.js page //feel free to copy and change this code as necessary (using your own copy, please); any modifications I have made from the source are public domain

function welcome_function { var f = document.editform, t = f.wpTextbox1; t.value += ""; f.wpSummary.value += "welcome!"; } function add_welcome_tab { // Only add for pages with the right string somewhere in the title if ((document.title.indexOf("Editing User talk:") != -1) && (document.title.indexOf("(new section)") == -1)) {     mw.util.addPortletLink('p-cactions', 'javascript:welcome_function', "Welcome this user!"); } } $(add_welcome_tab);