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
(upgrade for MW 1.35) |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
var portletId = UTCLiveClockConfig.portletId || 'p-personal'; | var portletId = UTCLiveClockConfig.portletId || 'p-personal'; | ||
var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById(UTCLiveClockConfig.nextNodeId) : undefined; | 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 ); | + | liveClock.node = mw.util.addPortletLink( portletId, mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge', '', 'utcdate', undefined, undefined, nextNode ); |
showTime(); | showTime(); | ||
− | + | ||
− | |||
} | } | ||
− | + | $(liveClock) | |
− | + | ||
function showTime() | function showTime() | ||
{ | { | ||
Line 26: | Line 25: | ||
var ss = now.getUTCSeconds(); | var ss = now.getUTCSeconds(); | ||
var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss ); | var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss ); | ||
− | dateNode.firstChild. | + | dateNode.firstChild.replaceChildren( document.createTextNode( time + " " ) ); |
window.setTimeout(showTime, 1000); | window.setTimeout(showTime, 1000); | ||
} | } |
Latest revision as of 23:15, 12 November 2022
function liveClock()
{
if (typeof(UTCLiveClockConfig)=='undefined') UTCLiveClockConfig = {};
var portletId = UTCLiveClockConfig.portletId || 'p-personal';
var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById(UTCLiveClockConfig.nextNodeId) : undefined;
liveClock.node = mw.util.addPortletLink( portletId, mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(mw.config.get('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.replaceChildren( document.createTextNode( time + " " ) );
window.setTimeout(showTime, 1000);
}