generated from Code-Institute-Org/gitpod-full-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
277 lines (254 loc) · 15.1 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Play Fizz Buzz in your browser, including a challenging hard mode!">
<meta name="keywords" content="Maths, Games, Numbers, FizzBuzz">
<meta name="author" content="David Kelly">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- Link to Stylesheet -->
<link rel="stylesheet" href="assets/css/style.css">
<!-- Favicon Links -->
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon/favicon-16x16.png">
<link rel="manifest" crossorigin="use-credentials" href="manifest.json">
<!-- Google Fonts Link -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Concert+One&family=Roboto:wght@400;700&display=swap"
rel="stylesheet">
<!-- Meta Tags for Social Media Shares -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.davidindub.com/fizzbuzz">
<meta property="og:title" content="Fizz Buzz">
<meta property="og:description" content="Play Fizz Buzz in your browser, including a challenging hard mode!">
<meta property="og:image" content="assets/images/social-share-thumb.png">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://www.davidindub.com/fizzbuzz">
<meta property="twitter:title" content="Fizz Buzz">
<meta property="twitter:description" content="Play Fizz Buzz in your browser, including a challenging hard mode!">
<meta property="twitter:image" content="assets/images/social-share-thumb.png">
<!-- Style Safari desktop/mobile and Chrome mobile UI to match theme -->
<meta name="theme-color" content="#fff">
<title>Fizz Buzz</title>
</head>
<body>
<header>
<div class="header-container">
<h1>FizzBuzz</h1>
<nav>
<ul>
<!-- Preferences Link -->
<li>
<a href="#" aria-label="Preferences" data-link="0" class="nav-item">
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="30" height="30"
fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16">
<path
d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" />
</svg>
</a>
</li>
<!-- Statistics Link -->
<li>
<a href="#" aria-label="Statistics" data-link="1" class="nav-item">
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="30" height="30"
fill="currentColor" class="bi bi-bar-chart" viewBox="0 0 16 16">
<path
d="M4 11H2v3h2v-3zm5-4H7v7h2V7zm5-5v12h-2V2h2zm-2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1h-2zM6 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm-5 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-3z" />
</svg>
</a>
</li>
<!-- Rules Link -->
<li>
<a href="#" aria-label="How To Play" data-link="2" class="nav-item">
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="30" height="30"
fill="currentColor" class="bi bi-question-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path
d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286zm1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94z" />
</svg>
</a>
</li>
</ul>
</nav>
</div>
</header>
<main>
<section class="game-info">
<span id="game-info-text" aria-live="assertive">Start counting from 1...</span>
<progress id="timer" value="100" max="100" class="visually-hidden"></progress>
</section>
<section id="game-btns">
<!-- Buttons to play the game with, can be clicked/tapped or use arrow keys -->
<button class="btn-game" id="btn-num" data-game-btn="number" aria-live="assertive">1</button>
<br>
<button class="btn-game" data-game-btn="fizz">Fizz</button>
<button class="btn-game" data-game-btn="buzz">Buzz</button>
<br>
<button class="btn-game" data-game-btn="fizzbuzz">Fizz<br>Buzz</button>
<audio id="sound-game-over" class="visually-hidden">
<source src="assets/sounds/game-over.m4a">
</audio>
<audio id="sound-right-answer" class="visually-hidden">
<source src="assets/sounds/right-answer.m4a">
</audio>
</section>
</main>
<!-- Footer -->
<footer>
<p class="prefs-text">
© David Kelly 2022. View on <a href="https://github.com/davidindub/fizzbuzz" target="_blank"
rel="noopener" aria-label="GitHub repository for this project (opens in a new tab)"><svg
xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-github"
viewBox="0 0 16 16">
<path
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z" />
</svg> GitHub</a>.
</footer>
<!-- Modals -->
<!-- Preferences Modal -->
<aside class="modal" aria-labelledby="modal-prefs-title">
<div class="modal-content">
<button class="close" aria-label="Close">×</button>
<h2 id="modal-prefs-title">Preferences</h2>
<label for="prefs-hard-mode" class="prefs-label">
<input type="checkbox" name="prefs-hard-mode" id="prefs-hard-mode" class="prefs-check">
<span class="prefs-toggle"></span>
Hard Mode
</label>
<br>
<p class="prefs-text">Non sequential random numbers!</p>
<hr>
<label for="prefs-timer" class="prefs-label">
<input type="checkbox" name="prefs-timer" id="prefs-timer" class="prefs-check" checked>
<span class="prefs-toggle"></span>
Timer
</label>
<br>
<p class="prefs-text">Toggle the timer for answering.</p>
<hr>
<label for="prefs-dark-mode" class="prefs-label">
<input type="checkbox" name="prefs-dark-mode" id="prefs-dark-mode" class="prefs-check">
<span class="prefs-toggle"></span>
Dark Mode
</label>
<hr>
<label for="prefs-sounds" class="prefs-label">
<input type="checkbox" name="prefs-sounds" id="prefs-sounds" class="prefs-check" checked>
<span class="prefs-toggle"></span>
Sound Effects
</label>
</div>
</aside>
<!-- A statistics modal -->
<aside class="modal" aria-labelledby="modal-stats-title">
<div class="modal-content">
<button class="close" aria-label="Close">×</button>
<h2 id="modal-stats-title">Statistics</h2>
<table id="scoreboard">
<thead>
<tr>
<th>Mode</th>
<th>High Score</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>Regular</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Hard</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<hr>
<p>
Last Score: <span id="stats-last-score"></span>
</p>
<hr>
<p>
Total Games Played: <span id="stats-games-played"></span>
</p>
<hr>
<div id="stats-btns">
<button id="btn-share" class="btn-stats btn-share">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-share-fill" viewBox="0 0 16 16">
<path
d="M11 2.5a2.5 2.5 0 1 1 .603 1.628l-6.718 3.12a2.499 2.499 0 0 1 0 1.504l6.718 3.12a2.5 2.5 0 1 1-.488.876l-6.718-3.12a2.5 2.5 0 1 1 0-3.256l6.718-3.12A2.5 2.5 0 0 1 11 2.5z" />
</svg>
Share Scores</button>
<button id="btn-clear-stats" class="btn-stats">Clear All Stats</button>
</div>
</div>
</aside>
<!-- A modal to appear on first visit explaining the rules of FizzBuzz -->
<aside class="modal" aria-labelledby="modal-rules-title" aria-describedby="modal-rules-text">
<!-- Modal content -->
<div class="modal-content">
<button class="close" aria-label="Close">×</button>
<h2 id="modal-rules-title">How to Play</h2>
<p id="modal-rules-text">Counting upwards from 1...
<br>
If the number is divisible by three choose <strong>Fizz</strong>.
<br>
If it is divisible by five choose <strong>Buzz</strong>.
<br>
If it is divisible by three <strong>and</strong> five choose <strong>FizzBuzz</strong>.
<br>
Otherwise select the Number.
</p>
<br>
<p>You only have five seconds to answer!
<br>
In Hard Mode numbers are non-sequential.
<br>
<br>
You can read more about FizzBuzz on <a href="https://en.wikipedia.org/wiki/Fizz_buzz" target="_blank"
rel="noopener" aria-label="Wikipedia entry for Fizz Buzz (opens in a new tab)">Wikipedia</a>.
<hr>
You can click, tap, or use your keyboard's arrow keys to play:
<br><br>
<svg xmlns="http://www.w3.org/2000/svg" role="presentation" width="16" height="16" fill="currentColor"
class="bi bi-arrow-up-square" viewBox="0 0 16 16">
<text class="visually-hidden">Up Arrow key to choose</text>
<path fill-rule="evenodd"
d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm8.5 9.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V11.5z" />
</svg>
Number
<br>
<svg xmlns="http://www.w3.org/2000/svg" role="presentation" aria-label="left-arrow" width="16"
height="16" fill="currentColor" class="bi bi-arrow-left-square" viewBox="0 0 16 16">
<text class="visually-hidden">Left Arrow key to choose</text>
<path fill-rule="evenodd"
d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm11.5 5.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H11.5z" />
</svg>
Fizz
<br>
<svg xmlns="http://www.w3.org/2000/svg" role="presentation" aria-label="right-arrow" width="16"
height="16" fill="currentColor" class="bi bi-arrow-right-square" viewBox="0 0 16 16">
<text class="visually-hidden">Right Arrow key to choose</text>
<path fill-rule="evenodd"
d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm4.5 5.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z" />
</svg>
Buzz
<br>
<svg xmlns="http://www.w3.org/2000/svg" role="presentation" aria-label="down-arrow" width="16"
height="16" fill="currentColor" class="bi bi-arrow-down-square" viewBox="0 0 16 16">
<text class="visually-hidden">Down Arrow key to choose</text>
<path fill-rule="evenodd"
d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm8.5 2.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z" />
</svg>
FizzBuzz
</div>
</aside>
<script src="assets/js/script.js"></script>
</body>
</html>