-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
369 lines (343 loc) · 17.6 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Guess the number</title>
<meta name="description" content="¡Guess the number!">
<meta name="keywords" content="Adivinar, numeros, digitos, posicion">
<link rel="icon" type="image/x-icon" href="./source/img/character_2.ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./source/css/style.css">
<link rel="stylesheet" href="./source/css/background.css">
<link rel="stylesheet" href="./source/css/animation.css">
<link rel="stylesheet" href="./source/css/characters.css">
<link rel="stylesheet" href="./source/css/stats.css">
<!-- Stats-->
<script src="https://www.gstatic.com/charts/loader.js"></script>
</head>
<body id="body" class="position-relative">
<div id="backgroundNumbers" class="backgroundNumbers position-absolute"></div>
<audio id="addNumber" src="./source/audio/addNumber.mp3"></audio>
<audio id="gameOver" src="./source/audio/gameOver.mp3"></audio>
<audio id="opening" src="./source/audio/opening.mp3"></audio>
<audio id="repeatNumber" src="./source/audio/repeatNumber.mp3"></audio>
<audio id="winGame" src="./source/audio/winGame.mp3"></audio>
<audio id="popUp" src="./source/audio/popUp.wav"></audio>
<audio id="characterSound" src="./source/audio/characterSound.wav"></audio>
<main id="main" class="container-xl mb-3">
<section id="infoSection" class=" flex-column justify-content-center align-items-center">
<h1 id="dynamic-title" class="text-center text-warning title-shadow display-3 mb-5 text-uppercase font-Title">
</h1>
<div class="row text-end d-flex align-items-center justify-content-center mh-100">
<h2 class="text-center col-12 display-6 fw-bolder">¡Welcome to "Guess the number"!</h2>
<img class="col-md-6 character_main pb-2 h-500 w-500" src="./source/img/number_character.webp" alt="numberGuess character">
<div class="col-md-6 d-flex flex-column justify-content-between">
<p class="text-shadow lead">You must guess a 4 digit number.
</p>
<p class="text-shadow lead">In "Ok" you will see how many numbers you have hit</p>
<p class="text-shadow lead">In "In position/Pos" you will see how many numbers are ordered.
</p>
<p class="text-shadow lead">There may be repeated numbers, for instance <strong>0112</strong>.</p>
<p class="text-shadow lead">You have <strong>10</strong> attempts left to guess the number <br>¡Good luck!</p>
<button id="playButton" class="btn btn-warning col-12 mb-md-0 mb-5 text-uppercase fw-bolder">PLAY</button>
</div>
</div>
</section>
<section id="gameSection" class="d-none d-flex flex-column justify-content-start opacity pt-5 container-sm">
<div>
<p class="text-center lead">You <span id="spanAttempts"></span> left to guess the number.
</p>
</div>
<div class="d-flex justify-content-center pb-1 gap-1 gap-sm-3">
<button title="Information/rules" id="infoButton" type="button" class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#rules">
<i class="bi bi-info-circle"></i>
</button>
<button title="Game stats" id="statsButton" type="button" class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#stats"><i class="bi bi-graph-up"></i>
</button>
<button title="Score ranking" id="rankingButton" type="button" class="btn btn-warning" data-bs-toggle="modal"
data-bs-target="#ranking">
<i class="bi bi-list-stars"></i>
</button>
<button title="Reset the game" id="resetButton" type="button" class="btn btn-dark"><i class="bi bi-arrow-clockwise"></i>
</button>
</div>
<div class="d-flex justify-content-center">
<progress class="text-center lead" id="progressBar" min="0" value="10" max="10"></progress>
</div>
<div id="attemptsDiv" class="d-flex flex-column justify-content-center align-items-center">
<p class="d-none" id="radioDiv">
<button id="buttonCollapse" class="btn btn-warning" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseRadio" aria-expanded="false" aria-controls="collapseRadio">
attempts
</button>
</p>
<div>
<div class="collapse collapse-horizontal" id="collapseRadio">
<div class="card card-body">
<div class="btn-group" id="inputGroup" role="group" aria-label="Basic radio toggle button group">
<input type="radio" class="btn-check" name="attempts" id="btnradio1" autocomplete="off">
<label class="btn btn-outline-warning" for="btnradio1">5 attempts</label>
<input type="radio" class="btn-check" name="attempts" id="btnradio2" autocomplete="off" checked>
<label class="btn btn-outline-warning" for="btnradio2">10 attempts</label>
<input type="radio" class="btn-check" name="attempts" id="btnradio3" autocomplete="off">
<label class="btn btn-outline-warning" for="btnradio3">20 attempts</label>
</div>
</div>
</div>
</div>
</div>
<div class="d-flex flex-column align-items-center pb-2 position-sticky sticky-top">
<label for="numberGuess" class="form-label text-center lead">Enter <strong>4</strong> digits</label>
<input type="number" class="form-control text-center lead fs-4 " id="numberGuess" min="0" maxlength="4"
max="9999" aria-describedby="numberGuess" autocomplete="off" autocorrect="off" autocapitalize="off"
spellcheck="false" step="1" pattern="[0-9]*" inputmode="numeric">
</div>
<div id="resultDiv" class="d-none">
<p id="result" class="p-2 rounded m-1 text-center lead text-white title-shadow">
</p>
</div>
<div id="rowsContainer" class="pb-2 mb-5 container-sm">
<div
class="row bg-warning position-relative align-items-center text-center lead bold rounded-top rounded-right">
<div class="col-6 d-none d-sm-block">Number</div>
<div class="col-6 d-block d-sm-none">Num</div>
<div class="col-3 border d-none d-sm-block border-top-0 border-bottom-0">OK</div>
<div class="col-3 border d-block d-sm-none border-top-0 border-bottom-0">Ok</div>
<div class="col-3 d-none d-sm-block">In position</div>
<div class="col-3 d-block d-sm-none">Pos</div>
</div>
<div id="rows" class="lead shadow">
</div>
</div>
<div id="characterDiv" class="z-index-fixed container-sm">
</div>
</section>
</main>
<footer id="footer" class="position-fixed bottom-0 start-50 translate-middle-x">
<div class="text-center d-flex gap-sm-3 gap-3 bg-white rounded p-3 border">
<a href="https://twitter.com/lautadev" class="list-group-item list-group-item-action" target="_blank" aria-label="twitter"><i
class="bi bi-twitter"></i></a>
<a href="https://github.com/Lautarof25/guessTheNumber" class="list-group-item list-group-item-action"
target="_blank" aria-label="github">
<i class="bi bi-github"></i>
</a>
<a href="https://www.linkedin.com/in/lautadev/" class="list-group-item list-group-item-action" target="_blank" aria-label="linkedin"><i
class="bi bi-linkedin"></i></a>
</div>
</footer>
<!-- Modal victory/lose -->
<div class="modal" id="modalResult">
<div class="modal-dialog">
<div class="modal-content shadow">
<div class="modal-header">
<h5 class="modal-title" id="titleModal"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="fs-5">The number is: <span id="spanModal"></span></p>
<div id="winnerText" class="fs-5 d-none"><strong>Now you have more options to guess the number</strong>
<div class="d-flex flex-column justify-content-center align-items-center">
<p>
<button class="btn btn-warning" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseRadio" aria-expanded="false" aria-controls="collapseRadio" disabled>
Attempts
</button>
</p>
<div>
<div class="collapse-horizontal">
<div class="card card-body">
<div class="btn-group d-flex flex-column flex-sm-row" role="group" aria-label="Basic radio toggle button group">
<input type="radio" class="btn-check" autocomplete="off" disabled>
<label class="btn btn-outline-warning">5 Attempts</label>
<input type="radio" class="btn-check" autocomplete="off" checked disabled>
<label class="btn btn-outline-warning">10 Attempts</label>
<input type="radio" class="btn-check" autocomplete="off" disabled>
<label class="btn btn-outline-warning">20 Attempts</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal info -->
<div class="modal fade" id="rules" tabindex="-1" aria-labelledby="rulesLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content shadow">
<div class="modal-header bg-warning">
<h1 class="modal-title fs-5" id="rulesLabel">ℹ️ Information</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body text-center">
<p>📌 You must guess a 4 digit number</p>
<p>📌 In "Ok" you will see how many numbers you have hit</p>
<p class="mb-0">📌In "In position/Pos" you will see how many numbers are ordered.</p>
<div
class="row bg-warning align-items-center position-relative text-center lead bold rounded-top rounded-right">
<div class="col-6">Number</div>
<div class="col-3 border border-top-0 border-bottom-0">Ok</div>
<div class="col-3">Pos</div>
</div>
<div class="lead shadow bold">
<div class="row position-relative bg-white rowAnimation text-center">
<div class="col-6 border text-danger">1234</div>
<div class="col-3 border">4</div>
<div class="col-3 border text-danger">0</div>
</div>
<div class="row position-relative bg-white rowAnimation text-center">
<div class="col-6 border">2<span class="text-danger">3</span>4<span class="text-danger">1</span></div>
<div class="col-3 border">4</div>
<div class="col-3 border">2</div>
</div>
<div class="row position-relative bg-white rowAnimation text-center">
<div class="col-6 border">2143</div>
<div class="col-3 border">4</div>
<div class="col-3 border">4</div>
</div>
</div>
<p class="mt-3">📌 There may be repeated numbers, for instance <strong>0112</strong>.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal stats -->
<div class="modal fade" id="stats" tabindex="-1" aria-labelledby="statsLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content shadow">
<div class="modal-header bg-warning">
<h1 class="modal-title fs-5" id="statsLabel">📊 Stats</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="statsTable" class="modal-body">
<p>🥇 Won: <span id="spanWin"></span></p>
<p>❌ Lost: <span id="spanLose"></span></p>
<p>🏁 Total games: <span id="spanTotal"></span></p>
<p>💯 Total score: <span id="spanScore"></span></p>
<small class="form-text text-muted">Points category:
<ul>
<li>5 attempts: 5 points (25)</li>
<li>10 attempts: 1 point (10)</li>
<li>20 attempts: 0.5 points (10)</li>
</ul>
</small>
</div>
<div id='myStats' style="max-width:700px"><!-- Plotly chart will be drawn inside this DIV --></div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal ranking -->
<div class="modal fade" id="ranking" tabindex="-1" aria-labelledby="rankingLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content shadow">
<div class="modal-header bg-warning">
<h1 class="modal-title fs-5" id="rankingLabel">🔢 Ranking</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="rankingTable" class="modal-body table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Scores</th>
</tr>
</thead>
<tbody id="tbody">
<tr>
<th scope="row">1</th>
<td class="nameRow"></td>
<td class="scoreRow"></td>
</tr>
<tr>
<th scope="row">2</th>
<td class="nameRow"></td>
<td class="scoreRow"></td>
</tr>
<tr>
<th scope="row">3</th>
<td class="nameRow"></td>
<td class="scoreRow"></td>
</tr>
<tr>
<th scope="row">4</th>
<td class="nameRow"></td>
<td class="scoreRow"></td>
</tr>
<tr>
<th scope="row">5</th>
<td class="nameRow"></td>
<td class="scoreRow"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal save user -->
<div class="modal fade" id="modalUser" tabindex="-1" aria-labelledby="modalUserLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-warning">
<h1 class="modal-title fs-5" id="modalUserLabel">¿Save your nickname?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body d-flex justify-content-center flex-column align-items-center">
<p>Your new score is <span id="spanScoreUser"></span></p>
<label for="inputUserName">Enter your name</label>
<input name="inputName" id="inputUserName" class="form-control w-75" type="text" placeholder="Lautaro">
</div>
<div class="modal-footer">
<button type="button" id="buttonCancel" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" id="buttonSaveUser" data-bs-dismiss="modal" class="btn btn-warning" disabled>Save</button>
</div>
</div>
</div>
</div>
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script defer src="./source/js/storageData/session.js"></script>
<script defer src="./source/js/dom/dom.js"></script>
<script defer src="./source/js/dom/buttons/buttons.js"></script>
<script defer src="./source/js/dom/stats/stats.js"></script>
<script defer src="./source/js/dom/ranking/ranking.js"></script>
<script defer src="./source/js/dom/radio/radio.js"></script>
<script defer src="./source/js/dom/user/user.js"></script>
<script defer src="./source/js/game/ranking.js"></script>
<script defer src="./source/js/stats.js"></script>
<script defer src="./source/js/animations/backgroundNumbers.js"></script>
<script defer src="./source/js/animations/dinamicTitle.js"></script>
<script defer src="./source/js/audios.js"></script>
<script defer src="./source/js/scrollMoveMobile.js"></script>
<script defer src="./source/js/functionsEvents.js"></script>
<script defer src="./source/js/game/randomNumber.js"></script>
<script defer src="./source/js/game/attempts.js"></script>
<script defer src="./source/js/game/validInput.js"></script>
<script defer src="./source/js/messages/showCharacters.js"></script>
<script defer src="./source/js/game/checkNumbers.js"></script>
<script defer src="./source/js/messages/popUpMessages.js"></script>
<script defer src="./source/js/game/guessMachine.js"></script>
<script defer src="./source/js/game/templateRowNumbers.js"></script>
<script defer src="./source/js/messages/displayFinalMessage.js"></script>
<script defer src="./source/js/messages/checkWinnerModal.js"></script>
<script defer src="./source/js/game/scores.js"></script>
<script defer src="./source/js/events.js"></script>
</body>
</html>