User:Lataus/common.js

mw.loader.using('mediawiki.api', function { var pstClockE=document.createElement("div");pstClockE.id="pst-c-w";pstClockE.innerHTML=" PST Clock Penguin Standard Time    NOW      TODAY   "; document.getElementById("WikiaRail").appendChild(pstClockE);var pwrCB=document.getElementById("pwr-cb");function getHr(a){a-=8;return 0a?a:13<=a?a-12:a+12}function getMin(a){return 10<=a?a:"0"+a}function g1S71(a){return 10<=a?a:"0"+a}function udTime{var a=document.getElementById("time"),b=new Date;a.innerText=getHr(b.getUTCHours)+":"+getMin(b.getUTCMinutes)+":"+g1S71(b.getUTCSeconds)} function udRest{var days=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur"];var day=document.getElementById("day"),am_pm=document.getElementById("am_pm"),b=new Date;var timeout;b.setUTCHours(b.getUTCHours-8);day.innerText=days[b.getUTCDay]+"day";if(b.getUTCHours<12)am_pm.innerText="AM";else am_pm.innerText="PM";if(b.getUTCHours===23||b.getUTCHours===11)timeout=setTimeout(udRest,1E3);else{clearTimeout(timeout);timeout=setTimeout(udRest,42E4)}}udTime;setInterval(udTime,1E3);udRest; try{pwrCB.addEventListener("click",udTime,!1);pwrCB.addEventListener("click",udRest,!1)}catch(e){pwrCB.parentNode.removeChild(pwrCB)} });