User:Audacity/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
//***Loader***//
window.onload = Main;
function Main() {
addlinks();
addtoolboxlinks();
}
 
//**Popups: [[User:Lupin/popups.js]]**//
 
popupRevertSummary="revert vandalism to version %s using [[:en:Wikipedia:Tools/Navigation_popups|popups]]"
popupRevertSummaryPrompt=true
popupQueriedRevertSummary="revert vandalism to version dated $2 by $3 using [[:en:Wikipedia:Tools/Navigation_popups|popups]]"
popupQueriedRevertToPreviousSummary="revert vandalism to version dated $2 by $3 using [[:en:Wikipedia:Tools/Navigation_popups|popups]]"
 
//***Add User Talk Links***//
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;
}
 
function addlinks() {
  var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
  if (document.title.indexOf("Editing User talk:") == 0) {
   addlilink(tabs, 'javascript:welcome()', 'w', '');
   addlilink(tabs, 'javascript:welcomem("welcomenpov")', 'wnpov', '');
   addlilink(tabs, 'javascript:editsummary("editsummary")', 'ess', '');
   addlilink(tabs, 'javascript:editsummary("summary")', 'esl', '');
   addlilink(tabs, 'javascript:vandalask("uw-test1")', 't1', '');
   addlilink(tabs, 'javascript:vandalask("uw-vandalism1")', 'v1', '');
   addlilink(tabs, 'javascript:vandalask("uw-spam1")', 's1', '');
   addlilink(tabs, 'javascript:vandalask("uw-delete1")', 'd1', '');
   addlilink(tabs, 'javascript:vandalask("uw-joke1")', 'j1', '');
   addlilink(tabs, 'javascript:vandalask("uw-test2")', 't2', '');
   addlilink(tabs, 'javascript:vandalask("uw-vandalism2")', 'v2', '');
   addlilink(tabs, 'javascript:vandalask("uw-spam2")', 's2', '');
   addlilink(tabs, 'javascript:vandalask("uw-delete2")', 'd2', '');
   addlilink(tabs, 'javascript:vandalask("uw-joke2")', 'j2', '');
   addlilink(tabs, 'javascript:vandalask("uw-vandalism3")', 'v3', '');
   addlilink(tabs, 'javascript:vandalask("blatantvandal")', 'bv3', '');
   addlilink(tabs, 'javascript:vandalask("uw-spam3")', 's3', '');
   addlilink(tabs, 'javascript:vandalask("uw-vandalism4")', 'v4', '');
   addlilink(tabs, 'javascript:vandalask("test4im")', 'bv4', '');
   addlilink(tabs, 'javascript:vandalask("uw-spam4")', 's4', '');
    }
  if (document.title.indexOf("Editing") == 0 && document.title.indexOf("Editing User") != 0) {
   addlilink(tabs, 'javascript:inuse()', 'inuse', '');
   }
  }
 
function welcome() {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  var type = prompt("user or anon?");
  var article = prompt("article?");
  var topic = prompt("topic?");
  var portal = prompt("portal?");
  var project = prompt("project?");
  txt.value += '{{subst:' + 'User:Audacity/Welcome|me=Audacity|type=' + type + '|article=' + article + '|topic=' + topic + '|portal=' + portal + '|project=' + project + '}}';
  document.editform.wpSummary.value = 'Welcome';
  document.editform.wpWatchthis.checked = false;
  }
 
function welcomem(tmplt) {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  var article = prompt("article?");
  txt.value += '{{subst:' + tmplt + '|' + article + '}}~~' + '~~';
  document.editform.wpSummary.value = 'Welcome';
  document.editform.wpWatchthis.checked = false;
  }
 
function vandalask(tmplt) {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  var article = prompt("article?");
  txt.value += '{{subst:' + tmplt + '|' + article + '}} ~~' + '~~';
  document.editform.wpSummary.value = 'Edits to ' + article;
  document.editform.wpWatchthis.checked = false;
}
 
function inuse() {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  var time = prompt("until?");
  txt.value += '{{' + 'inuse||for=|until ' + time + '}}'
  document.editform.wpSummary.value = 'in use until' + time;
  document.editform.wpWatchthis.checked = false;
  }
 
function editsummary(tmplt) {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  txt.value += '{{subst:' + tmplt + '}}~~' + '~~';
  document.editform.wpSummary.value = 'Edit summaries';
  document.editform.wpWatchthis.checked = false;
}