-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
44 lines (41 loc) · 1.01 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
<style>
@font-face {
font-family: 'Century Gothic';
src: url('.\\Century\\Gothic.ttf');
}
span {
display: inline-block;
vertical-align: middle;
line-height: normal;
}
div {
font-family: Century Gothic;
height: 100%;
line-height: 100px;
text-align: center;
}
</style>
<body>
<div>
<span>
<h1 style="text-align:center">hi go take a break now</h1>
<h1 style="text-align:center" id="timer"></h1>
</span>
</div>
<script src="/socket.io.js"></script>
<script>
var socket = io('http://localhost:8899');
var interval = setInterval(async function() {
var focused = document.hasFocus();
if(!focused) {
clearInterval(interval);
socket.emit("unfocused")
window.close()
}
}, 100);
socket.on('close', () => {window.close()})
socket.on('time', (t) => {
document.getElementById('timer').innerText = "Time left: " + t + " seconds.";
})
</script>
</body>