User:Numa Numa/monobook.js
From Homestar Runner Wiki
< User:Numa Numa
Revision as of 03:16, 1 September 2007 by Cow Puncher (Talk | contribs)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Mozilla / Firefox: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac)
- Safari: press Cmd-Option-E
- IE: hold Ctrl while clicking Refresh, or press Ctrl-F5
- Konqueror: simply click the Reload button, or press F5
- Opera users may need to completely clear their cache in Tools→Preferences.
function getTime() { var time = new Date(); var hours = time.getUTCHours(); if (hours < 10) { hours = "0" + hours; } var minutes = time.getUTCMinutes(); if (minutes < 10) { minutes = "0" + minutes; } var seconds = time.getUTCSeconds(); if (seconds < 10) { seconds = "0" + seconds; } var currentTime = hours + ":" + minutes + ":" + seconds; document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 8, currentTime); doTime = window.setTimeout("getTime()", 1000); } function makeTime() { var div = document.createElement( 'div' ); div.id = 'pt-time'; var mySpan = document.createElement( 'span' ); mySpan.appendChild( document.createTextNode( '00:00:00 UTC' ) ); div.appendChild( mySpan ); document.getElementById( 'globalWrapper' ).parentNode.appendChild( div ); doTime = window.setTimeout("getTime()", 1000); } if (window.addEventListener) window.addEventListener ('load', makeTime, false); else if (window.attachEvent) window.attachEvent ('onload', makeTime);