User:Technical 13/Scripts/Gadget-LiveClock.js

( function( $, undefined ) { var $target; function showTime( $target ) {	var dateNode = LiveClockConfig.node;	if( !dateNode ) {		return;	}	var now = new Date;	var nowUTC = new Date;	var hh = now.getHours;	var hhUTC = nowUTC.getUTCHours;	var mm = now.getMinutes;	var mmUTC = nowUTC.getUTCMinutes;	var ss = now.getSeconds;	var ssUTC = nowUTC.getUTCSeconds;	if ( $target === undefined ) {		$target = $( dateNode ).find( 'a:first' );	}	var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );	var timeUTC = ( hhUTC < 10 ? '0' + hhUTC : hhUTC ) + ':' + ( mmUTC < 10 ? '0' + mmUTC : mmUTC ) + ':' + ( ssUTC < 10 ? '0' + ssUTC : ssUTC );	$target.text( time );	$target.attr('title', timeUTC + ' UTC\nClick to refresh page' );	setTimeout( function{ showTime( $target ); }, 1000 ); } function liveClock {	appendCSS( '#utcdate a { font-weight: bolder; font-size: 120%; }' );	if ( window.LiveClockConfig === undefined ) {		window.LiveClockConfig = {};	}	var portletId = LiveClockConfig.portletId || 'p-personal';	var nextNode = LiveClockConfig.nextNodeId ? document.getElementById( LiveClockConfig.nextNodeId ) : undefined;	LiveClockConfig.node = mw.util.addPortletLink( portletId, mw.config.get( 'wgScript' ) + '?title=' + encodeURIComponent( mw.config.get( 'wgPageName' ) ) + '&action=purge', '',		'utcdate', undefined, undefined, nextNode );	if( !LiveClockConfig.node ) {		return;	}	showTime; } $( document ).ready( liveClock ); } )( jQuery );