-
Notifications
You must be signed in to change notification settings - Fork 15
/
presenter.html
72 lines (58 loc) · 1.46 KB
/
presenter.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
---
layout: default
---
<div>
<h1 id="time">No pressure!</h1>
</div>
<ul>
{% for entry in site.hacks %}
{% if entry.submission_url %}
<li>🎉 <a href="{{ entry.submission_url }}">{{ entry.name }}.</a></li>
{% else %}
<li>{{ entry.name }} hasn't submitted yet 😒.</li>
{% endif %}
{% else %}
<li>No hacks yet 😭</li>
{% endfor %}
</ul>
<!-- the head tag is for losers -->
<link href="https://fonts.googleapis.com/css?family=Fira+Mono" rel="stylesheet">
<!-- inline JS is for winners -->
<!-- stolen from http://codepen.io/jmikey/pen/tFHrp/ -->
<script>
var secondsRemaining;
var intervalHandle;
function timerEnd() {
startCountdown();
}
function tick(){
// grab the h1
var timeDisplay = document.getElementById("time");
// turn the seconds into mm:ss
var min = Math.floor(secondsRemaining / 60);
var sec = secondsRemaining - (min * 60);
//add a leading zero (as a string value) if seconds less than 10
if (sec < 10) {
sec = "0" + sec;
}
// concatenate with colon
var message = min.toString() + ":" + sec;
// now change the display
timeDisplay.innerHTML = message;
// stop is down to zero
if (secondsRemaining === 0){
clearInterval(intervalHandle);
timerEnd();
}
//subtract from seconds remaining
secondsRemaining--;
}
function startCountdown(){
var minutes = 3;
secondsRemaining = minutes * 60;
intervalHandle = setInterval(tick, 1000);
}
window.onload = function(){
startCountdown();
}
</script>