User:Chieftain Alex/vector clock.js

/** Clock ** * Time bit salvaged from mediawikiwiki:MediaWiki:Gadget-UTCLiveClock.js by User:AzaToth * Portlet bit from ResourceLoader/Default_modules * For use with the Vector skin. */

var clockLink = mw.util.addPortletLink( 'p-personal', '/wiki/' + wgPageName + '?action=purge', 'UTC time', 'ca-clock',                                       'Purge the server cache and update the contents of this page.', '', '#pt-userpage' ); clockLink.style.textTransform = 'uppercase'; clockLink.style.fontWeight = 'bold';

function showTime { var now = new Date; var hh = now.getUTCHours; var mm = now.getUTCMinutes; var ss = now.getUTCSeconds; var time = (hh < 10 ? '0' + hh : hh) + ':' + (mm < 10 ? '0' + mm : mm) + ':' + (ss < 10 ? '0' + ss : ss) + ' (UTC)'; clockLink.firstChild.replaceChild (document.createTextNode (time), clockLink.firstChild.firstChild); window.setTimeout (showTime, 1000); } showTime;