-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
89 lines (81 loc) · 2.46 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<title>GameJam Countdown</title>
<link href='https://fonts.googleapis.com/css?family=Noticia+Text' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="public/site.css" />
</head>
<body>
<div id="wrapperForColor">
<div id="wrapperForColorWindow"></div>
<div id="background-progress">
</div>
<div class="container">
<div class="item hidden">Nog <span class="hours"></span>:<span class="minutes"></span>:<span class="seconds"></span></div>
<div class="item toHide"><bold>De GameJam is <br /> nog <strong>niet</strong> begonnen</bold></div>
</div>
</div>
<div id="sticky-logo"></div>
<div id="dgdarc-logo"></div>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script>
var socket = io();
socket.on('tick', function(timeLeft) {
if (timeLeft.started)
{
$(".hidden").removeClass("hidden");
$(".toHide").addClass("hidden");
var plurals = {
days: {
singular: "dag",
plural: "dagen"
},
hours: {
singular: "uur",
plural: "uren"
},
minutes: {
singular: "minuut",
plural: "minuten"
},
seconds: {
singular: "seconde",
plural: "seconden"
}
}
console.log(timeLeft.percentage);
var start = moment(timeLeft.start);
var end = moment(timeLeft.end);
t = end.diff(start);
var seconds = Math.floor( (t/1000) % 60 );
var minutes = Math.floor( (t/1000/60) % 60 );
var hours = Math.floor( (t/(1000*60*60)) );
$(".hours").html(zeroPad(hours, 2));
$(".hours-info").html(pluralize(hours, plurals.hours))
$(".minutes").html(zeroPad(minutes, 2));
$(".minutes-info").html(pluralize(minutes, plurals.minutes))
$(".seconds").html(zeroPad(seconds, 2));
$(".seconds-info").html(pluralize(seconds, plurals.seconds))
$("#background-progress").css("width", (100*(timeLeft.percentage))+"%");
} else {
$(".item").addClass("hidden");
$(".toHide").removeClass("hidden");
$("#background-progress").css("width", (100*(timeLeft.percentage))+"%");
}
});
function zeroPad(num, places) {
var zero = places - num.toString().length+1;
return Array(+(zero > 0 && zero)).join("0") + num;
}
function pluralize(num, object) {
if (num != 1)
{
return object.plural;
}
return object.singular;
}
</script>
</body>
</html>