User:Clubjuggle/liveclock.js

/* To turn on seconds display, add the following line to your monobook.js: window.liveClockShowSeconds = true; addOnloadHook(function {  var tabNode = mw.util.addPortletLink("p-personal", wgScript + "?title=" + encodeURIComponent(mw.config.get('wgPageName')) + "&action=purge", "", "utcdate");  var linkNode = tabNode.getElementsByTagName("a")[0];  var updateTimeSeconds = function  {    var now = new Date ;    var h = now.getUTCHours;    var m = now.getUTCMinutes;    var s = now.getUTCSeconds + (now.getUTCMilliseconds >= 500 ? 1 : 0);   linkNode.innerHTML = (h<10?"0":"") + h + (m<10?":0":":") + m + (s<10?":0":":") + s;    setTimeout(updateTimeSeconds, 1500 - ((now.getTime + 500) % 1000));  };  var updateTimeMinutes = function  {    var now = new Date ;    var h = now.getUTCHours;    var m = now.getUTCMinutes + (now.getUTCSeconds >= 30 ? 1 : 0);   linkNode.innerHTML = (h<10?"0":"") + h + (m<10?":0":":") + m;    setTimeout(updateTimeMinutes, 90000 - ((now.getTime + 30000) % 60000));  };  if (window.liveClockShowSeconds) updateTimeSeconds;  else updateTimeMinutes; });