mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
Made DigitFade optional
This commit is contained in:
parent
9560862b42
commit
3229b23cda
@ -5,7 +5,7 @@ var time = {
|
||||
updateInterval: 1000,
|
||||
intervalId: undefined,
|
||||
displaySeconds: (typeof config.time.displaySeconds == 'undefined') ? true : config.time.displaySeconds,
|
||||
|
||||
digitFade: (typeof config.time.digitFade == 'undefined') ? true : config.time.digitFade,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -38,35 +38,43 @@ time.updateTime = function () {
|
||||
this.updateTime();
|
||||
}.bind(this), seconds*1000);
|
||||
}
|
||||
var diff = $('<div>').html(html);
|
||||
diff.find('.digit').each(function( index ) {
|
||||
var _text = $( this ).text();
|
||||
var _i = index+1;
|
||||
var liveNode = $(timeLocation).find('.digit')[index]
|
||||
if (typeof liveNode != 'undefined') {
|
||||
liveNode = $(liveNode);
|
||||
var _text2 = liveNode.text();
|
||||
if (_text != _text2) {
|
||||
|
||||
liveNode.addClass('fade');
|
||||
if (this.digitFade) {
|
||||
var diff = $('<div>').html(html);
|
||||
diff.find('.digit').each(function( index ) {
|
||||
var _text = $( this ).text();
|
||||
var _i = index+1;
|
||||
var liveNode = $(timeLocation).find('.digit')[index]
|
||||
if (typeof liveNode != 'undefined') {
|
||||
liveNode = $(liveNode);
|
||||
var _text2 = liveNode.text();
|
||||
if (_text != _text2) {
|
||||
|
||||
liveNode.addClass('fade');
|
||||
$(this).addClass('fade');
|
||||
}
|
||||
} else {
|
||||
$(this).addClass('fade');
|
||||
}
|
||||
});
|
||||
if ($('.fade').length == 0) {
|
||||
// Initial Update
|
||||
$(this.timeLocation).html(diff.html());
|
||||
diff = undefined;
|
||||
} else {
|
||||
$(this).addClass('fade');
|
||||
$('.fade').fadeTo(400, 0.25, function() {
|
||||
if (typeof diff != 'undefined') {
|
||||
$(this.timeLocation).html(diff.html());
|
||||
diff = undefined;
|
||||
}
|
||||
$('.fade').fadeTo(400, 1).removeClass('fade');
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
if ($('.fade').length == 0) {
|
||||
// Initial Update
|
||||
$(timeLocation).html(diff.html());
|
||||
diff = undefined;
|
||||
} else {
|
||||
$('.fade').fadeTo(400, 0.25, function() {
|
||||
if (typeof diff != 'undefined') {
|
||||
$(timeLocation).html(diff.html());
|
||||
diff = undefined;
|
||||
}
|
||||
$('.fade').fadeTo(400, 1).removeClass('fade');
|
||||
}).bind(this);
|
||||
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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user