Community Central
Community Central
No edit summary
No edit summary
Tag: sourceedit
Line 18: Line 18:
   
 
$(document).ready(function() {
 
$(document).ready(function() {
if (skin != 'oasis') { CLOCK_ID = "#ca-watch a"; }
+
if (skin != 'oasis') {
  +
$( '<li id="ca-time"><a href="#"></a></li>').appendTo('#p-cactions > .pBody > ul' );
  +
CLOCK_ID = "#ca-time a";
  +
}
 
 
 
$(CLOCK_ID).attr("title", 'Purge the server cache and update the contents of this page.');
 
$(CLOCK_ID).attr("title", 'Purge the server cache and update the contents of this page.');

Revision as of 17:22, 1 April 2015

/* 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 = "<small style='font-size:70%;'>(" + dd + ")</small>" + ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );
	$(CLOCK_ID).empty().append('<span>' + time + '</span>');
	window.clearTimeout(refreshDate);
	refreshDate = window.setTimeout(showTime, 1000);
}

$(document).ready(function() {
	if (skin != 'oasis') {
		$( '<li id="ca-time"><a href="#"></a></li>').appendTo('#p-cactions > .pBody > ul' );
		CLOCK_ID = "#ca-time 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('<li><a id="displayTimer"></a></li>');
		
		$('#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('<li id="displayTimer"></li>');
	}*/
	showTime();
	refreshDate = window.setTimeout(showTime, 1000);
});