MédhiaWiki:Gadget-UTCLiveClock.js

Cathetan: Bare nyimpen preferensi, panjenengan kudu mbusak cache panjlajah web panjenengan kanggo mirsani pangowahan. Mozilla / Firefox / Safari: pencèt Ctrl-Shift-R (Cmd-Shift-R nang Apple Mac); IE: teken Ctrl-F5; Konqueror:: pencet F5; Opera resikana cache miturut menu Tools→Preferences.

function liveClock()
{

	/*liveClock.node = */mw.util.addPortletLink( 'p-personal',
		mw.config.get('wgServer')
		+ mw.config.get('wgScriptPath')
		+ '/index.php?title='
		+ mw.config.get('wgPageName')
		+ '&action=purge', '', 'utcdate' )[0];
	// liveClock.node.style.fontSize = 'larger';
	// liveClock.node.style.fontWeight = 'bolder';
	

	showTime();
}
$(liveClock);

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 );
	$("#utcdate").children().html(time);

    window.setTimeout(showTime, 1000);
}