diff --git a/index.php b/index.php index aa0c876ff7..89a5389df5 100644 --- a/index.php +++ b/index.php @@ -13,8 +13,8 @@ -
+
diff --git a/js/time/time.js b/js/time/time.js index f2a5a28691..311ef2d4f0 100644 --- a/js/time/time.js +++ b/js/time/time.js @@ -1,8 +1,8 @@ var time = { timeFormat: config.time.timeFormat || 24, dateLocation: '.date', - timeLocation: '.time', - updateInterval: 1000, + timeLocation: '#time', + updateInterval: 10000, intervalId: null }; @@ -10,12 +10,26 @@ var time = { * Updates the time that is shown on the screen */ time.updateTime = function () { - - var _now = moment(), - _date = _now.format('dddd, LL'); - - $(this.dateLocation).html(_date); - $(this.timeLocation).html(_now.format(this._timeFormat+':mm[]ss[]')); + var timeLocation = this.timeLocation; + var _now = moment(); + var _date = _now.format('[]dddd,[ ]LL[]'); + + $(this.dateLocation).updateWithText(_date, 1000); + $('.fade').removeClass('fade') + var diff = $('
').html(_now.format(this._timeFormat+':mm').replace(/./g, "$&")); + diff.children().each(function( index ) { + var _text = $( this ).text(); + var _i = index+1; + var _text2 = $(timeLocation + ' span:nth-child('+_i+')').text(); + if (_text != _text2) { + $(timeLocation +' span:nth-child('+_i+')').addClass('fade'); + $(this).addClass('fade'); + } + }); + $('.fade').fadeTo(400, 0.25, function() { + $(timeLocation).html(diff.html()); + $(timeLocation).children().fadeTo(400, 1).removeClass('fade'); + }).bind(this); } @@ -26,9 +40,11 @@ time.init = function () { } else { time._timeFormat = 'HH'; } + $(this.timeLocation).html(''); this.intervalId = setInterval(function () { this.updateTime(); - }.bind(this), 1000); + }.bind(this), this.updateInterval); + this.updateTime(); } \ No newline at end of file