User:Connel MacKenzie/monobook.js

From Meta, a Wikimedia project coordination wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// <pre>
 function addLoadEvent(func) {
  if (window.addEventListener) 
    window.addEventListener("load", func, false);
  else if (window.attachEvent) 
    window.attachEvent("onload", func);
 }

 document.write('<script ' 
            + 'type="text/javascript" src="http://en.wiktionary.org'
            + '/w/index.php?title=User:Connel_' 
            + 'MacKenzie/spellcheck.js&action=raw&ctype=text/javascript"><\/' 
            + 'script>');

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></'
             + 'script>');

 // add "favorites" to navigation box thing on left column
function addToNav() {
  var lastnav = document.getElementById('n-sitesupport');
  var newnav;
  var newa;

  // get page title
  var pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue;
  if (pagetitle.search(/Search/) != -1) {
    pagetitle = document.getElementById('contentSub').firstChild.nodeValue;
    pagetitle = pagetitle.replace(/For query /g, "");
    pagetitle = pagetitle.replace(/\"/g, "");
  }
  pagetitle = pagetitle.replace(/Editing /g, "");
  var pageexternal = pagetitle.replace(/\ /g, "_");
  var pageext =      pagetitle.replace(/\ /g, "+");

 //[[wikt:pagetitleexternal|wikt:pagetitle]]
  newnav = document.createElement('li');
  newa = document.createElement('a');
  newa.href='/wiki/wikt:' + pageexternal;
  newa.appendChild(document.createTextNode('wikt: ' + pagetitle));
  newnav.appendChild(newa);
  lastnav.parentNode.appendChild(newnav);
  ta['wikt: ' + pagetitle] = new Array('','Wiktionary quicklink for this same title');

 //[[wikt:Special:Recentchanges]] - quick and dirty way to get back to Wikt: when above link is broken (i.e. namespace, or page on wikt: won't exist.)
  newnav = document.createElement('li');
  newa = document.createElement('a');
  newa.href='/wiki/wikt:Special:Recentchanges';
  newa.appendChild(document.createTextNode('wikt: Special:RC'));
  newnav.appendChild(newa);
  lastnav.parentNode.appendChild(newnav);
  ta['wikt: Special:RC'] = new Array('','Wiktionary quicklink for this Special:Recentchanges');
}

function reformatMyPage() {
  addToNav() ;
}

 
var hack = 'failed';
var hack_pagetitle ='';
 
if (window.addEventListener) window.addEventListener("load",reformatMyPage,false);
else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);

 // </pre>