-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
87 lines (76 loc) · 2.07 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pipodoro</title>
<link rel="icon" href="icons/favicon.svg">
<link rel="manifest" href="manifest.json">
<meta name="description" content="Pomodoro timer with Picture-In-Picture & Sync capabilities. PWA App with zero dependencies.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
<meta property="og:title" content="Pipodoro. Pomodoro timer with Picture-In-Picture & Sync capabilities. PWA App with zero dependencies.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://pipodo.ro">
-->
<style>
:root {
--background: #000;
--color: #fff;
}
body {
background: var(--background);
color: var(--color);
min-height: 100vh;
overflow: hidden;
margin: 0;
display: grid;
}
#app {
display: grid;
}
#video {
background-color: var(--background);
width: 100%;
align-self: center;
}
</style>
</head>
<body onload="app.setup()">
<div id="app" >
<video id="video"
muted="muted"
autoplay="true"
playsinline
controls
onpause="app.pause()"
onplay="app.play()">
</video>
</div>
<script type="module">
import {Timer} from './timer.js';
import {UI} from './ui.js';
import {convertStringToSeconds} from './utils.js';
let ui;
let timer;
const timeParam = new URLSearchParams(window.location.search).get('time');
const seconds = timeParam ? convertStringToSeconds(timeParam) : 1500;
window.app = {
setup() {
ui = new UI({video: document.getElementById('video')});
timer = new Timer({seconds});
ui.setTime(timer.seconds);
timer.addEventListener('tick', (evt) => ui.setTime(evt.detail));
},
pause() {
timer.pause();
},
play() {
timer.start();
}
}
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("./sw.js");
}
</script>
</body>
</html>