User:Lifebaka/welcome.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Lifebaka/welcome. |
//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 [[Wikipedia: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 += "{{subst:" + "User:Lifebaka/Welcome" + "}}";
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);