Made DigitFade optional

This commit is contained in:
Jonathan Vogt 2016-01-29 11:36:56 +01:00
parent 9560862b42
commit 3229b23cda

View File

@ -5,7 +5,7 @@ var time = {
updateInterval: 1000, updateInterval: 1000,
intervalId: undefined, intervalId: undefined,
displaySeconds: (typeof config.time.displaySeconds == 'undefined') ? true : config.time.displaySeconds, displaySeconds: (typeof config.time.displaySeconds == 'undefined') ? true : config.time.displaySeconds,
digitFade: (typeof config.time.digitFade == 'undefined') ? true : config.time.digitFade,
}; };
/** /**
@ -38,6 +38,7 @@ time.updateTime = function () {
this.updateTime(); this.updateTime();
}.bind(this), seconds*1000); }.bind(this), seconds*1000);
} }
if (this.digitFade) {
var diff = $('<div>').html(html); var diff = $('<div>').html(html);
diff.find('.digit').each(function( index ) { diff.find('.digit').each(function( index ) {
var _text = $( this ).text(); var _text = $( this ).text();
@ -57,16 +58,23 @@ time.updateTime = function () {
}); });
if ($('.fade').length == 0) { if ($('.fade').length == 0) {
// Initial Update // Initial Update
$(timeLocation).html(diff.html()); $(this.timeLocation).html(diff.html());
diff = undefined; diff = undefined;
} else { } else {
$('.fade').fadeTo(400, 0.25, function() { $('.fade').fadeTo(400, 0.25, function() {
if (typeof diff != 'undefined') { if (typeof diff != 'undefined') {
$(timeLocation).html(diff.html()); $(this.timeLocation).html(diff.html());
diff = undefined; diff = undefined;
} }
$('.fade').fadeTo(400, 1).removeClass('fade'); $('.fade').fadeTo(400, 1).removeClass('fade');
}).bind(this); }.bind(this));
}
} else {
if (this.displaySeconds) {
$(this.timeLocation).html(_now.format(this._timeFormat+':mm[<span class="sec">]ss[</span>]'));
} else {
$(this.timeLocation).html(_now.format(this._timeFormat+':mm'));
}
} }
} }