This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoreCounter.html
77 lines (67 loc) · 2.19 KB
/
scoreCounter.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Score counter</title>
<link rel="stylesheet" href="main.css"/>
<!--<link rel="stylesheet" href="shapes.css"/>-->
<link rel="stylesheet" href="score.css"/>
</head>
<body class="shown">
<div class="container hcenter-contents score-container shown">
<div class="team left">OHG</div>
<div class="trapezoid right"></div>
<div class="score" data-team1="0" data-team2="0" id="counter">
:
<div class="clock shown">
<div id="timelabel" class="timelabel shown">
35:10
</div>
</div>
</div>
<div class="trapezoid left"></div>
<div class="team right">ABI</div>
</div>
<script src="websocket.js"></script>
<script>
function hide() {
document.body.className = "hidden";
}
window["startTime"] = 0;
window["pauseTime"] = 0;
Date.prototype.getFullMinutes = function() {
if (this.getMinutes() < 10) {
return '0' + this.getMinutes();
} else {
return this.getMinutes().toString()
}
};
Date.prototype.getFullSeconds = function() {
if (this.getSeconds() < 10) {
return '0' + this.getSeconds();
} else {
return this.getSeconds().toString()
}
};
function getDeltaTimeAsString() {
var start = variables["startTime"];
var pause = variables["pauseTime"];
if (start === 0) {
return "00:00"
} else {
console.log(start);
var elapsed = new Date(Date.now() - start);
if (pause !== 0) {
elapsed = new Date(new Date(pause) - start);
}
return elapsed.getFullMinutes() + ":" + elapsed.getFullSeconds()
}
}
function updateTime() {
document.getElementById("timelabel").innerHTML = getDeltaTimeAsString()
}
updateTime();
setInterval(updateTime, 1000)
</script>
</body>
</html>