-
Notifications
You must be signed in to change notification settings - Fork 0
/
scorebug.html
52 lines (45 loc) · 1.46 KB
/
scorebug.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
<!DOCTYPE html>
<html>
<head>
<title>Scorebug | Esports Wales</title>
<script src="js/WsSubscribers.js"></script>
<script src="js/jquery-3.5.1.min.js"></script>
<link rel="stylesheet" href="css/scorebug.css">
</head>
<body background="assets/scorebug.png">
<div id="blue-score-container" class="score-container">
<div id="blue-score"></div>
</div>
<div id="orange-score-container" class="score-container">
<div id="orange-score"></div>
</div>
<div id="timer-container">
<div id="timer"></div>
</div>
</body>
<script>
$(() => {
WsSubscribers.init(49322, false);
WsSubscribers.subscribe("game", "update_state", (d) => {
let timeText = "";
if (d['game']['isOT']) {
timeText += "+ ";
}
if (d['game']['time'] < 0) {
timeText += "0:00"
} else {
timeText += parseInt(Math.ceil(d['game']['time_seconds']) / 60) + ":";
timeText += ("0" + Math.ceil(d['game']['time_seconds'] - (parseInt(Math.ceil(d['game']['time_seconds']) / 60) * 60))).slice(-2);
}
$("#timer").text(timeText);
if (d['game']['isOT']) {
$("#timer-container").addClass("overtime");
} else {
$("#timer-container").removeClass("overtime");
}
$("#blue-score").text(d['game']['teams'][0]['score']);
$("#orange-score").text(d['game']['teams'][1]['score']);
});
});
</script>
</html>