-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
127 lines (106 loc) · 3.36 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Rosary Timer</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<style>
body {
background-color: #8f8c8c;
font-size: xx-large;
color: #2b2727;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.container {
border: #8f8c8c 2px solid;
border-radius: 8%;
display: flex;
flex-direction: column;
justify-items: center;
justify-content: center;
text-align: center;
background-color: rgb(212, 3, 3);
padding: 1rem;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
justify-content: space-evenly;
width: 32rem;
max-width: 32rem;
min-width: 32rem;
}
.item {
display: flex;
justify-content: space-evenly;
flex-direction: row;
flex: content;
margin-bottom: 1rem;
}
button {
background-color: white;
border: 0;
border-radius: 10%;
padding: 0.5rem;
width: auto;
font-size: larger;
}
button:enabled:hover {
background-color: gainsboro;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<div id="info" class="item">
Press Start to begin the rosary
</div>
<div class="item">
<button id="next" disabled type="button">Next</button>
<button id="startStop" type="button">Start</button>
</div>
</div>
<!-- JS -->
<script>
const info = document.getElementById("info");
const next = document.getElementById("next");
const startStop = document.getElementById("startStop");
// States
let stopped = true;
let prayersLeft = 55; // 5 for Our Father and 50 for Our Lady
document.stopped = stopped;
// Init
setDefaults();
// Click handlers
next.onclick = (event) => {
// When finished reset
if (prayersLeft <= 0) return setDefaults();
prayersLeft--;
if (prayersLeft === 44 || prayersLeft === 33 || prayersLeft === 22 || prayersLeft === 11)
info.innerText = "Prayer: Our Father";
else info.innerText = "Prayer: Our Lady";
};
startStop.onclick = (event) => {
// Reverse boolean
stopped = !stopped;
// Default condition after starting
if (!stopped) info.innerText = "Prayer: Our Father";
if (stopped) setDefaults();
else {
startStop.innerText = "Stop";
next.disabled = false;
}
};
// A reset to default function
function setDefaults(){
info.innerText = "Press Start for a new rosary";
prayersLeft = 55;
next.disabled = true;
startStop.innerText = "Start";
stopped = true;
}
</script>
</body>
</html>