User:Curiouscrab/global.js

military=false; UTC=false; timezone='EDT'; importScriptPage('Mediawiki:Common.js/displayClockLocal.js', 'admintools'); // make pages open in new tab for(i=0;i<document.getElementById('mw-content-text').getElementsByTagName('a').length;i++) { document.getElementById('mw-content-text').getElementsByTagName('a')[i].target='_blank'; } // check if user is viewing page var viewing; $(window).on("blur focus", function(e) {   var prevType = $(this).data("prevType");

if (prevType != e.type) {  //  reduce double fire issues switch (e.type) { case "blur": viewing = 'blur'; break; case "focus": viewing = 'focus'; break; }   }

$(this).data("prevType", e.type); }) // reload page automatically after time if(wgAction=='view' && wgNamespaceNumber!==-1) { setInterval(function { if(viewing=='blur') { window.location.reload(true); } }, 60000); }