Jump to content

User:Iamthejabberwock/monobook.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.
//<nowiki>
//***Loader***//
 window.onload = Main;
 function Main() {
 addlinks();
 }

//***Add User Talk Links***//
 function addlilink(tabs, url, name, id) {
  var na = document.crenateElement('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:vandal("welcomenpov")', 'wnpov', '');
   addlilink(tabs, 'javascript:editsummary()', 'es', '');
   addlilink(tabs, 'javascript:vandalask("test0-n")', 'tgf', '');
   addlilink(tabs, 'javascript:vandalask("test-self-n")', 'ts', '');
   addlilink(tabs, 'javascript:vandalask("test-n")', 't1', '');
   addlilink(tabs, 'javascript:vandalask("spam-n")', 'spam', '');
   addlilink(tabs, 'javascript:vandalask("vw")', 'bv1', '');
   addlilink(tabs, 'javascript:vandalask("test2-n")', 't2', '');
   addlilink(tabs, 'javascript:vandalask("spam-n")', 's2', '')
   addlilink(tabs, 'javascript:vandalask("test3-n")', 't3', '');
   addlilink(tabs, 'javascript:vandalask("anon vandal-n")', 'ta3', '');
   addlilink(tabs, 'javascript:vandalask("blatantvandal")', 'bv4', '');
    }
  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:Iamthejabberwock/Welcome|me=Iamthejabberwock|type=' + type + '|article=' + article + '|topic=' + topic + '|portal=' + portal + '|project=' + project + '}}~~' + '~~';
  document.editform.wpSummary.value = 'welcome';
  document.editform.wpWatchthis.checked = true;
  }

 function vandal(tmplt) {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  txt.value += '{{subst:' + tmplt + '}}~~' + '~~';
  document.editform.wpSummary.value = '+{{' + tmplt + '}}';
  document.editform.wpWatchthis.checked = true;
  }

 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 = '+{{' + tmplt + '|' + article + '}}';
  document.editform.wpWatchthis.checked = true;
 }

 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 = true;
  }

 function editsummary() {
  var txt = document.editform.wpTextbox1;
  if (txt.value.length > 0) txt.value += '\n';
  txt.value += '== Edit summaries == \n\n{{subst:' + 'edit summary}}~~' + '~~';
  document.editform.wpSummary.value = 'edit summaries';
  document.editform.wpWatchthis.checked = true;
 }

//**Hide Own Edits In Watchlist**//
 addOnloadHook(function () {
  for (var i=0; i<document.links.length; ++i) {
   if (document.links[i].href.indexOf('Special:Watchlist')>0) {
    document.links[i].href+='?hideOwn=1';
     break;
   }
  }
 });

//**Popups: [[User:Lupin/popups.js]]**

 mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');
 popupRevertSummary="rvv to version %s using [[:en:Wikipedia:Tools/Navigation_popups|popups]]"
 popupRevertSummaryPrompt=true
 popupDelay=1.5
 popupImages=false
 simplePopups=false
 popupOnEditSelection=false

//**Install [[User:Cacycle/diff]] Text Diff Tool**
 document.write('<script type="text/javascript" src="' 
  + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js' 
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//**Install [[User:Cacycle/editor]] Edit Tool**//
 document.write('<script type="text/javascript" src="' 
  + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/editor.js' 
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//**Add [edit top] Link** (by [[User:Pile0nades]])**//

 //add link
 addOnloadHook(function () {
  //if this is preview page or generated page, stop
  if (document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;
 // get page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 
 // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';

  // insert divContainer into the DOM before the h1
  if (window.location.href.indexOf("&action=edit") == -1)
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

  if(window.location.href.indexOf("&action=edit&section=0") != -1)
    document.getElementById("wpSummary").value = "/* Intro */ ";
 });
//</nowiki>