v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Difference between revisions of "User:Emi/clock.js"
< User:Emi
Jump to navigation
Jump to search
(addOnloadHook -> $) |
|||
Line 11: | Line 11: | ||
} | } | ||
− | + | $(liveClock) | |
function showTime() | function showTime() |
Revision as of 00:48, 10 June 2019
function liveClock()
{
if (typeof(UTCLiveClockConfig)=='undefined') UTCLiveClockConfig = {};
var portletId = UTCLiveClockConfig.portletId || 'p-personal';
var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById(UTCLiveClockConfig.nextNodeId) : undefined;
liveClock.node = addPortletLink( portletId, wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', '', 'utcdate', undefined, undefined, nextNode );
showTime();
}
$(liveClock)
function showTime()
{
var dateNode = liveClock.node;
if( !dateNode ) {
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 );
dateNode.firstChild.replaceChild( document.createTextNode( time + " " ), dateNode.firstChild.firstChild );
window.setTimeout(showTime, 1000);
}