Skip to content

Commit be1428e

Browse files
committed
Update
1 parent e1532d0 commit be1428e

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

rotation-timer.html

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<html>
2+
3+
<head>
4+
<title>Rotation Time</title>
5+
6+
7+
8+
</head>
9+
10+
<body>
11+
<h1>Rotation Time</h1>
12+
13+
<label>
14+
Rotation in minutes
15+
<input id="rotation" name="rotation" type="number" value="10" onchange="update()" min="1" required/>
16+
</label>
17+
<label>
18+
Participants
19+
<input id="size" name="size" type="number" value="4" onchange="update()" min="3" required />
20+
</label>
21+
22+
<div>
23+
Time to next turn (or time for Twitter): <span id="timeToNextTurn">30</span> minutes
24+
</div>
25+
26+
<div>
27+
<h3>What if?</h3>
28+
<div>
29+
+1 participant: <span id="timeToNextTurnPlusOne">20</span> minutes
30+
</div>
31+
<div>
32+
-1 participant: <span id="timeToNextTurnMinusOne">40</span> minutes
33+
</div>
34+
</div>
35+
36+
37+
<script type="application/javascript">
38+
function timeToNextTurn(rotation, size) {
39+
return rotation * (size - 1)
40+
}
41+
42+
function update() {
43+
let rotation = parseInt(document.getElementById('rotation').value)
44+
let size = parseInt(document.getElementById('size').value)
45+
46+
document.getElementById('timeToNextTurn').innerText = timeToNextTurn(rotation, size)
47+
document.getElementById('timeToNextTurnPlusOne').innerText = timeToNextTurn(rotation, size + 1)
48+
document.getElementById('timeToNextTurnMinusOne').innerText = timeToNextTurn(rotation, size - 1)
49+
}
50+
51+
update()
52+
</script>
53+
54+
</body>
55+
56+
</html>

0 commit comments

Comments
 (0)