mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
move compliments out into its own file
This commit is contained in:
27
js/main.js
27
js/main.js
@@ -200,32 +200,7 @@ jQuery(document).ready(function($) {
|
||||
}, 1000);
|
||||
})();
|
||||
|
||||
(function updateCompliment()
|
||||
{
|
||||
//see compliments.js
|
||||
while (compliment == lastCompliment) {
|
||||
|
||||
//Check for current time
|
||||
var compliments;
|
||||
var date = new Date();
|
||||
var hour = date.getHours();
|
||||
//set compliments to use
|
||||
if (hour >= 3 && hour < 12) compliments = morning;
|
||||
if (hour >= 12 && hour < 17) compliments = afternoon;
|
||||
if (hour >= 17 || hour < 3) compliments = evening;
|
||||
|
||||
compliment = Math.floor(Math.random()*compliments.length);
|
||||
}
|
||||
|
||||
$('.compliment').updateWithText(compliments[compliment], 4000);
|
||||
|
||||
lastCompliment = compliment;
|
||||
|
||||
setTimeout(function() {
|
||||
updateCompliment(true);
|
||||
}, 30000);
|
||||
|
||||
})();
|
||||
compliments.init();
|
||||
|
||||
(function updateCurrentWeather()
|
||||
{
|
||||
|
Reference in New Issue
Block a user