-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
67 lines (65 loc) · 2.42 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
<!DOCTYPE html>
<html>
<head>
<title>Hyperdeck Time Remaining</title>
<style>
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#messages {font-size: 42vh;display: flex; justify-content: center; align-items: center;text-align:center;min-height:100vh;overflow:hidden;}
.yalert { background-color: yellow}
.ralert { background-color: red; color: white}
.balert { background-color: red; color: white; animation: blink 1s 1s infinite;}
.ok {background-color: black; color: white}
.connecting { font-size: 10vh !important; background-color: black; color: white}
@keyframes pulse {
from {opacity: 0.5;}
50% {opacity: 1;}
to {opacity: 0.5;}
}
.connecting::after {
content: "Connecting...";
animation-name: pulse;
animation-duration: 1s;
animation-iteration-count: infinite;
}
.error {background-color: red; color: white; font-size: 10vh !important; animation: blink 1s 1s infinite;}
@keyframes blink {
from {background-color: red; color: white;}
50% {background-color: yellow; color: black;}
to {background-color: red;color: white;}
}
#ip {position: absolute; bottom: 0; right: 0; padding: 10px; color: white; font-size: 1vh; opacity: 40%}
#ip:hover {font-size: 5vh; background-color: black; opacity: 100%; cursor: help;}
#ip:hover::before {content: "HyperDeck IP: ";}
</style>
</head>
<body>
<div id="messages" class="connecting"></div>
<div id="ip">Waiting IP..</div>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
var item = document.getElementById('messages');
socket.on('time', function(msg) {
item.innerText = msg
const a = msg.split(':');
const seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
if(seconds<5) {
item.setAttribute('class', 'balert');
} else if(seconds<10) {
item.setAttribute('class', 'ralert');
} else if(seconds<30) {
item.setAttribute('class', 'yalert');
} else {
item.setAttribute('class', 'ok');
}
});
socket.on('erro', function(msg) {
item.innerText = msg
item.setAttribute('class', 'error');
});
socket.on('ip', function(ip) {
document.getElementById('ip').innerText = ip;
});
</script>
</body>
</html>