Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jamxu88 authored Jun 21, 2021
1 parent 10c567b commit 0a4f0c7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
Binary file added Century Gothic.ttf
Binary file not shown.
29 changes: 19 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<style>
span {
display: inline-block;
vertical-align: middle;
line-height: normal;
}
div {
height: 100%;
line-height: 100px;
text-align: center;
}
@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>
Expand All @@ -28,6 +34,9 @@ <h1 style="text-align:center">hi go take a break now</h1>
}
}, 100);
socket.on('close', () => {window.close()})
socket.on('time', (t) => {
document.getElementById('timer').innerText = "Time left: " + t + " seconds.";
})
</script>
</body>

Expand Down
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const delay = require('delay');

var active = false;
var unf = false;
var stime;
var tleft;

http.listen(8899, async () => {
})
Expand All @@ -30,11 +32,19 @@ io.on('connection', async (socket) => {

async function main() {
console.log("Starting break at")
console.log(new Date())
stime = new Date()
console.log(stime);
tleft = 120
var intv = setInterval(function x() {
console.log(tleft)
io.emit('time',tleft)
tleft -= 1;
if(tleft == 0) clearInterval(intv)
},1000)
bopen("http://localhost:8899")
active = true;
await delay(120000);
console.log("Ending break at")
console.log("Break ended at")
console.log(new Date())
active = false;
io.emit('close')
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -14,5 +15,9 @@
"express": "^4.17.1",
"http": "0.0.1-security",
"socket.io": "^4.1.2"
},
"pkg": {
"assets": ["/index.html", "/socket.io.js", "/Century Gothic.ttf"],
"targets": ["node12-win-x64"]
}
}

0 comments on commit 0a4f0c7

Please sign in to comment.