User:Mfaizsyahmi/toolbarclock/code.js

// Customized LiveClock from dev // Changes: display in toolbar, local time default, href to toggle to utc function liveClock { var link = 'javascript:showtime(true)'; if ( skin === 'monobook' ) { $( 'div .toolbar' ).append( ' ' ); } else if ( skin === 'oasis' ) { $( '#WikiaPage #WikiHeader div.buttons' ).prepend( '  ' ); } //	$( '#utcdate' ).css( { fontSize: 'larger', fontWeight: 'bolder', textTransform: 'none' } ); showTime(false); } $( liveClock ); function showTime(isutc) { var	now = new Date, months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ], if isutc==true { hh = now.getUTCHours, mm = now.getUTCMinutes, ss = now.getUTCSeconds, dd = now.getUTCDate, month = months[now.getUTCMonth], year  = now.getUTCFullYear, zone  = ' (UTC)' var link = 'javascript:showtime(false)'; }	else { hh = now.getHours, mm = now.getMinutes, ss = now.getSeconds, dd = now.getDate, month = months[now.getMonth], year  = now.getFullYear, zone  = ' (local)' var link = 'javascript:showtime(true)'; }	time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss ) + ', ' + ( dd < 10 ? '0' + dd : dd ) + ' ' + month + ' ' + year + zone; $( '#toolbardate a' ).text( time ); $( '#toolbardate a' ).href( link ); window.setTimeout( showTime, 1000 ); } //