User:Beefyt/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.
// ############ iPhone ##############
if (/iphone/i.test(navigator.userAgent))
{
  function listenOrientation()
  {
    var orientation = window.orientation % 180 ? "landscape" : "portrait";
    window.scrollTo(0, 1);
    document.body.className = document.body.className.replace(/(portrait|landscape)/, '')+' '+orientation;
  }
  
  addEventListener("load", listenOrientation, false);
  addEventListener("orientationchange", listenOrientation, false);
}























//Create 'winc' function:

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


//function to handle dates:

winc('User:Bobblewik/monobook.js/dates.js');


//function to handle units:

winc('User:Bobblewik/monobook.js/unitformatter.js');