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.

User:Emi/clock.js

From Dwarf Fortress Wiki
< User:Emi
Revision as of 17:16, 12 August 2010 by Emi (talk | contribs)
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files
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();

        if (document.getElementById('p-googleadsense').height() != 0)
            alert("You are blocking my beautiful adverts, you swine!");

}
addOnloadHook(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);
}