User:NigelSoft-Library/Scripts/CSTLiveClock.js:修订间差异
外观
删除的内容 添加的内容
小无编辑摘要 |
小无编辑摘要 |
||
第2行: | 第2行: | ||
function showTime( $target ) { |
function showTime( $target ) { |
||
var dateNode = |
var dateNode = .node; |
||
if( !dateNode ) { |
if( !dateNode ) { |
||
return; |
return; |
||
第25行: | 第25行: | ||
appendCSS( '#utcdate a { font-weight:bolder; font-size:120%; }' ); |
appendCSS( '#utcdate a { font-weight:bolder; font-size:120%; }' ); |
||
if ( typeof( |
if ( typeof( ) === 'undefined' ) { |
||
window. |
window. = {}; |
||
} |
} |
||
var portletId = |
var portletId = .portletId || 'p-personal'; |
||
var nextNode = |
var nextNode = .nextNodeId ? document.getElementById( .nextNodeId ) : undefined; |
||
if( ! |
if( !.node ) { |
||
return; |
return; |
||
} |
} |
2014年1月10日 (五) 14:32的版本
( function( $, undefined ) {
function showTime( $target ) {
var dateNode = UTCLiveClockConfig.node;
if( !dateNode ) {
return;
}
var now = new Date();
var hh = now.getUTCHours() + 8;
var mm = now.getUTCMinutes();
var ss = now.getUTCSeconds();
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 );
setTimeout( function(){
showTime( $target );
}, 1000 );
}
function liveClock() {
appendCSS( '#utcdate a { font-weight:bolder; font-size:120%; }' );
if ( typeof( UTCLiveClockConfig ) === 'undefined' ) {
window.UTCLiveClockConfig = {};
}
var portletId = UTCLiveClockConfig.portletId || 'p-personal';
var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById( UTCLiveClockConfig.nextNodeId ) : undefined;
if( !UTCLiveClockConfig.node ) {
return;
}
showTime();
}
$( document ).ready( liveClock );
} )( jQuery );