Jump to content

User:Moeron/welcome2.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Code originally by [[User:Raylu|raylu]]
// Modified by [[User:Moeron]]
// This script adds a "subst:welcome2" tab to the top of User pages
// when in edit mode.

function dowelcome2() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'welcome2' + '}' + '}' + ' ' + '~' + '~' + '~' + '~';
  document.editform.wpSummary.value = 'Welcome to Wikipedia!';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addwelcome2() {
  addTab("javascript:dowelcome2()", "subst:welcome2", "ca-welcome2", "subst:welcome2", "");
  akeytt();
}

$(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
  addOnloadHook(addwelcome2);
  }
});