Added different compliments for different times of the day

This commit is contained in:
Paul-Vincent Roll 2015-01-08 22:48:22 +01:00
parent 460cb40f56
commit 7d7bacfff7
2 changed files with 26 additions and 9 deletions

23
js/config.js Normal file → Executable file
View File

@ -1,7 +1,7 @@
// for navigator language // for navigator language
var lang = window.navigator.language; var lang = window.navigator.language;
// you can change the language // you can change the language
//var lang = 'en'; // var lang = 'en';
//change weather params here: //change weather params here:
//units: metric or imperial //units: metric or imperial
@ -17,13 +17,20 @@ var feed = 'http://feeds.nos.nl/nosjournaal?format=rss';
//var feed = 'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml'; //var feed = 'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml';
// compliments: // compliments:
var compliments = [ var morning = [
'Hey, handsome!', 'Good morning, handsome!',
'Hi, sexy!', 'Enjoy your day!',
'How was your sleep?'
];
var afternoon = [
'Hello, beauty!', 'Hello, beauty!',
'You look sexy!', 'You look sexy!',
'Wow, you look hot!', 'Looking good today!'
'Looking good today!',
'You look nice!',
'Enjoy your day!'
]; ];
var evening = [
'Wow, you look hot!',
'You look nice!',
'Hi, sexy!'
];

12
js/main.js Normal file → Executable file
View File

@ -204,7 +204,17 @@ jQuery(document).ready(function($) {
{ {
//see compliments.js //see compliments.js
while (compliment == lastCompliment) { while (compliment == lastCompliment) {
compliment = Math.floor(Math.random()*compliments.length);
//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); $('.compliment').updateWithText(compliments[compliment], 4000);