「MediaWiki:Common.js」の版間の差分

提供: Wikimedia Conference Japan 2009
移動先: 案内検索
(時計表示)
 
(修正)
23行目: 23行目:
 
var time =      ( hh < 10 ? '0' + hh : hh )
 
var time =      ( hh < 10 ? '0' + hh : hh )
 
+ ':' + ( mm < 10 ? '0' + mm : mm )
 
+ ':' + ( mm < 10 ? '0' + mm : mm )
+ ':' + ( ss < 10 ? '0' + ss : ss );
+
+ ':' + ( ss < 10 ? '0' + ss : ss ) + ' (UTC)';
  
 
node.firstChild.replaceChild( document.createTextNode( time ), node.firstChild.firstChild );
 
node.firstChild.replaceChild( document.createTextNode( time ), node.firstChild.firstChild );
 
   
 
   
     window.setTimeout(showTime, 1000);
+
     window.setTimeout(showClock, 1000);
 
}
 
}

2009年6月25日 (木) 15:14時点における版

/* ここに書いた JavaScript は全てのページ上で実行されます */

addOnloadHook(clock);

function clock()
{
 	clock.node = addPortletLink( 'p-personal', wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', '', 'time' );
	clock.node.style.fontWeight = 'bolder';
 
	showClock();
}
 
function showClock()
{
 	var node = clock.node;
	if( !node ) {
		return;
	}
    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 ) + ' (UTC)';

	node.firstChild.replaceChild( document.createTextNode( time ), node.firstChild.firstChild );
 
    window.setTimeout(showClock, 1000);
}