move compliments out into its own file

This commit is contained in:
Jon Heller
2015-10-18 16:03:20 -04:00
parent ed5fbed7d9
commit 4bca536404
3 changed files with 65 additions and 26 deletions

View File

@@ -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()
{