User:Fewfre/global.js/showServerTime.js

/* This Javascript inputs a clock next to the user navigation at the top of the page. */ /* Originally from: http://tardis.wikia.com/wiki/MediaWiki:Common.js/displayTimer.js */

var refreshDate; var CLOCK_ID = "#globalNavigation .start-wikia-container a";//"displayTimer";

function showTime { var	now = new Date, dd = now.getUTCDate, hh = now.getUTCHours, mm = now.getUTCMinutes, ss = now.getUTCSeconds, time = "(" + dd + ") " + ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss ); $(CLOCK_ID).empty.append(' ' + time + ' '); window.clearTimeout(refreshDate); refreshDate = window.setTimeout(showTime, 1000); }

$(document).ready(function {	if (skin != 'oasis') { CLOCK_ID = "#ca-watch a"; }	$(CLOCK_ID).attr("title", 'Purge the server cache and update the contents of this page.');	$(CLOCK_ID).attr("href", wgArticlePath.replace('$1', wgPageName.replace(/ /g, '_')) + '?action=purge');	if (skin == 'oasis') {		$(CLOCK_ID).css({ "font-family":"\'Futura\', \'Gill Sans\', \'Helvetica Neue\',\'Trebuchet MS\', sans-serif" });	}	/*if (skin == 'oasis') {		$('#AccountNavigation .user-menu').prepend('');		$('#displayTimer').attr("title", 'Purge the server cache and update the contents of this page.');		$('#displayTimer').attr("href", wgArticlePath.replace('$1', wgPageName.replace(/ /g, '_')) + '?action=purge');		$('#displayTimer').css({ "font-family":'\'Futura\', \'Gill Sans\', \'Helvetica Neue\',\'Trebuchet MS\', sans-serif' });	}	else {		$('#p-personal ul').prepend('');	}*/	showTime;	refreshDate = window.setTimeout(showTime, 1000); });