User:Magister Scienta/clock.js

/***** A modification of DavidClock created by Magister Scienta ************************************************** Puts an UTC clock in the upper right corner of all pages. See full documentation at User:Davidgothberg/clock. addOnloadHook( function { var static = true;  var tick = 60;  var date = true;  /* If the user has not declared "window.davidClock = x;"     then none of these if-cases become true, and the defaults     above will be used. */  if( window.davidClock >= 0 ) {    tick = window.davidClock;  }  else if( window.davidClock < 0 ) {    static = false;    tick = 0 - window.davidClock;  }  /* If the user has not declared "window.davidClockDate = x;" then     this if-case becomes false, and the default above will be used. */  if ( window.davidClockDate == 0 ) {    date = false;  }  /* Optimised ticker for 60 seconds or longer tick intervals. */  function updateTimeMinutes {    var now = new Date;    linkNode.innerHTML = now.toUTCString.substring(17,22);    setTimeout( updateTimeMinutes, tick * 1000 );  };  /* Optimised ticker for 1-59 seconds tick intervals. */  function updateTimeSeconds { var now = new Date; linkNode.innerHTML = now.toUTCString.substring(17,25); setTimeout( updateTimeSeconds, tick * 1000 ); }; /* Create the static clock. */ if( static ) { if( t==t ) {  /* Make it an edit section 0 link. */     var link = wgScript + '?title=' + wgPageName + '&action=purge'; var linkTooltip = 'Purge this page'; }

var now = new Date; var linkText = now.toUTCString.substring(17,22); addPortletLink( 'p-personal', link, linkText, 'pt-utcstatic', linkTooltip ); } } );

/* End Clock */