forked from maedox/isitcoffeetime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
62 lines (55 loc) · 2.49 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Is it coffee time?</title>
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAACJqckAAAAAAP///wBZeJYAJ01zAJHd6wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERERERERERERERERERERERERERERERERERREREERERERQiIiJBERERQlJSUlQRERFFJSUlJBEREUJSUlJURBERQiIiIiQUERFCREREJEQREUQAAABEERERFEREREERERERERERERERERExExExERERExExExERERERMRMRMRERH//wAA//8AAP//AADgfwAAwD8AAIAfAACAHwAAgAcAAIAXAACABwAAgB8AAMA/AAD//wAA7b8AANt/AADtvwAA" rel="icon" type="image/x-icon" />
<link rel=stylesheet href=//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css>
<script type="text/javascript">
function isItTime() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth();
var date = now.getDate();
// Soon time for first coffee
var first_soon = new Date(year, month, date, 09, 00, 0, 0);
// First coffee time slot
var first_begin = new Date(year, month, date, 09, 30, 0, 0);
var first_end = new Date(year, month, date, 11, 30, 0, 0);
// Soon time for second coffee
var second_soon = new Date(year, month, date, 13, 00, 0, 0);
// Second coffee time slot
var second_begin = new Date(year, month, date, 13, 30, 0, 0);
var second_end = new Date(year, month, date, 17, 00, 0, 0);
// So, is it coffee time? (0930 – 1130 and 1330 – 1700)
if ( now >= first_begin && now <= first_end || now >= second_begin && now <= second_end ) {
var coffeeTime = "Yes! 😃☕️‼️";
}
else if ( now >= first_soon && now < first_begin || now >= second_soon && now < second_begin ) {
var coffeeTime = "Soon 😌";
}
else {
var coffeeTime = "Nope ☹️";
}
document.getElementById('coffee_time').innerHTML = coffeeTime;
setTimeout('isItTime()', 1000);
}
</script>
</head>
<body onload="isItTime();">
<div class="container text-center">
<div class="jumbotron">
<h1>Is it coffee time?</h1>
<br />
<h2 id="coffee_time"></h2>
</div>
<p class="text-muted">
<a title="When is the best time to drink coffee?" href="http://en.ilovecoffee.jp/posts/view/57" target="_blank">Why?</a>
| <a title="@maedox on Twitter" href="https://twitter.com/maedox" target="_blank">@maedox</a>
| <a title="Fork me on GitHub" href="https://github.com/maedox/isitcoffeetime" target="_blank">GitHub</a>
</p>
</div>
</body>
</html>