blob: 44749fc48e19d7b1d52e4e824060809623fb9ea0 (
plain)
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
|
<!DOCTYPE HTML>
<html>
<head>
<title>Timer</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style/reset.css">
<link rel="stylesheet" href="style/main.css">
<link rel="stylesheet" href="style/font-awesome/css/font-awesome.min.css">
<link rel="icon" type="image/png" href="images/icon.png">
<script src="client.js"></script>
</head>
<body>
</body>
<script>
const timer = Elm.Main.fullscreen(new Date().getTime())
document.onkeypress = function(event) {
timer.ports.keyPress.send(event.which)
};
const sound = new Audio('alarm.wav');
sound.addEventListener('ended', function() {
this.currentTime = 0;
this.play();
}, false);
timer.ports.ring.subscribe(function(ring) {
if(ring) {
document.title = "~\\ Timer /~"
sound.play()
} else {
document.title = "Timer"
sound.pause()
sound.currentTime = 0
}
});
</script>
</html>
|