-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
39 lines (33 loc) · 1.31 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
<!DOCTYPE html>
<html>
<head>
<title>Tetris Clock</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<canvas id='canvas' width='400' height='200'></canvas>
<h1 id='date'></h1>
<script src="js/utils.js"></script>
<script src="js/Tetris.js"></script>
<script src="js/Shape.js"></script>
<script src="js/Clock.js"></script>
<script type='text/javascript'>
Tetris.context = document.getElementById('canvas').getContext('2d');
var now = new Date();
var endOfMinute = new Date();
var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var DAYS = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
Clock.refresh();
endOfMinute.setMinutes(now.getMinutes() + 1);
endOfMinute.setSeconds(0);
//Wait till the end of the minute
setTimeout(function () {
Clock.refresh();
//Refresh every min
setInterval(Clock.refresh, 60 * 1000);
}, endOfMinute - now);
document.getElementById('date').textContent = [DAYS[now.getDay()], now.getDate(), MONTHS[now.getMonth()], now.getFullYear()].join(' ');
</script>
</body>
</html>