User:Cash Money/monobook.js
From Homestar Runner Wiki
(Difference between revisions)
Cash Money (Talk | contribs) |
Cash Money (Talk | contribs) |
||
Line 9: | Line 9: | ||
} | } | ||
} | } | ||
- | if (window.addEventListener) window.addEventListener('load', | + | // Add UTC time just below the "personal menu" list at the top of the page. |
- | else if (window.attachEvent) window.attachEvent('onload', | + | // Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay |
+ | // | ||
+ | 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 currentTime = hours + ":" + minutes | ||
+ | document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 5, 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 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); |
Revision as of 02:04, 17 November 2009
// include utility functions document.write('<script type="text/javascript" src="/index.php?title=User:Phlip/utilities.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); function addLinks() { with (utilities) { addMonobookQuickbarLink("http://www.hrwiki.org/User:Movie_magic_man/sig", "my sig", "mytalk"); } } // Add UTC time just below the "personal menu" list at the top of the page. // Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay // 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 currentTime = hours + ":" + minutes document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 5, 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 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);