Pengguna:Kenrick95/clock-local.js: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Tidak ada ringkasan suntingan |
k Maintenance: Replacing addPortletLink() with mw.util.addPortletLink() (mw:ResourceLoader/Migration_guide_(users)#addPortletLink) |
||
(Satu revisi perantara oleh satu pengguna lainnya tidak ditampilkan) | |||
Baris 1:
( function( $, undefined ) {
function liveClock()▼
if (typeof(UTCLiveClockConfig)=='undefined') UTCLiveClockConfig = {};▼
var portletId = UTCLiveClockConfig.portletId || 'p-personal';▼
var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById(UTCLiveClockConfig.nextNodeId) : undefined;▼
}▼
function showTime()▼
▲ var dateNode = liveClock.node;
if( !dateNode ) {
return;
}
var now = new Date();
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getSeconds();
if ( typeof $target === 'undefined' ) {
$target = $( dateNode ).find( 'a:first' );
}
var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );
$target.text( time );
showTime( $target );
}, 1000 );
}
▲function liveClock() {
appendCSS( '#utcdate a { font-weight:bolder; font-size:120%; }' );
window.UTCLiveClockConfig = {};
}
▲ var portletId = UTCLiveClockConfig.portletId || 'p-personal';
▲ var nextNode =
UTCLiveClockConfig.node = mw.util.addPortletLink(
portletId,
wgScript + '?title=' + encodeURIComponent( wgPageName ) + '&action=purge',
'',
'utcdate',
undefined,
undefined,
nextNode
);
if( !UTCLiveClockConfig.node ) {
return;
}
▲}
$( document ).ready( liveClock );
} )( jQuery );
|