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,
|
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,35 +38,43 @@ time.updateTime = function () {
|
|||||||
this.updateTime();
|
this.updateTime();
|
||||||
}.bind(this), seconds*1000);
|
}.bind(this), seconds*1000);
|
||||||
}
|
}
|
||||||
var diff = $('<div>').html(html);
|
if (this.digitFade) {
|
||||||
diff.find('.digit').each(function( index ) {
|
var diff = $('<div>').html(html);
|
||||||
var _text = $( this ).text();
|
diff.find('.digit').each(function( index ) {
|
||||||
var _i = index+1;
|
var _text = $( this ).text();
|
||||||
var liveNode = $(timeLocation).find('.digit')[index]
|
var _i = index+1;
|
||||||
if (typeof liveNode != 'undefined') {
|
var liveNode = $(timeLocation).find('.digit')[index]
|
||||||
liveNode = $(liveNode);
|
if (typeof liveNode != 'undefined') {
|
||||||
var _text2 = liveNode.text();
|
liveNode = $(liveNode);
|
||||||
if (_text != _text2) {
|
var _text2 = liveNode.text();
|
||||||
|
if (_text != _text2) {
|
||||||
|
|
||||||
liveNode.addClass('fade');
|
liveNode.addClass('fade');
|
||||||
|
$(this).addClass('fade');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$(this).addClass('fade');
|
$(this).addClass('fade');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
if ($('.fade').length == 0) {
|
||||||
|
// Initial Update
|
||||||
|
$(this.timeLocation).html(diff.html());
|
||||||
|
diff = undefined;
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
$('.fade').fadeTo(400, 0.25, function() {
|
if (this.displaySeconds) {
|
||||||
if (typeof diff != 'undefined') {
|
$(this.timeLocation).html(_now.format(this._timeFormat+':mm[<span class="sec">]ss[</span>]'));
|
||||||
$(timeLocation).html(diff.html());
|
} else {
|
||||||
diff = undefined;
|
$(this.timeLocation).html(_now.format(this._timeFormat+':mm'));
|
||||||
}
|
}
|
||||||
$('.fade').fadeTo(400, 1).removeClass('fade');
|
|
||||||
}).bind(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user