-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
344 lines (344 loc) · 14.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<link href="./assets/favicon.ico" rel="icon" type="image/x-icon" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ESP</title>
<!-- CSS only -->
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
crossorigin="anonymous"
/>
<!-- https://elrumordelaluz.github.io/csshake/ -->
<link
rel="stylesheet"
type="text/css"
href="https://csshake.surge.sh/csshake.min.css"
/>
<link rel="stylesheet" href="./src/index.css" />
</head>
<body>
<div id="app">
<div class="container">
<!-- for some reason toggling modals doesn't work in BS5 yet?? -->
<button
type="button"
class="btn btn-primary d-none"
data-toggle="modal"
id="gameOverBtn"
data-target="#gameOverModal"
></button>
<!-- settings modal -->
<div
class="modal fade"
id="settingsModal"
data-keyboard="false"
tabindex="-1"
aria-labelledby="settingsModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered">
<div
class="modal-content"
style="min-height: 400px"
:class="currentTheme"
>
<div class="modal-header">
<h5 class="modal-title" id="settingsModal">Settings</h5>
</div>
<div class="modal-body" id="settingsModalBody">
<p class="mt-2">Theme changes will reload the application</p>
<div class="form-group mt-2">
<label for="themeSetting">Theme</label>
<select
v-model="currentTheme"
class="form-control"
@change="setAppTheme"
>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<p class="mt-2">
System Reduced Motion preferences will overwrite Vibration and
Shake preferences. Vibration is not supported on all devices.
</p>
<div class="form-check mt-2">
<label class="form-check-label">
Vibrate device when incorrect
<input
type="checkbox"
class="form-check-input"
v-model="vibrate"
true-value="true"
false-value="false"
@change="setCookie('vibrate', vibrate)"
/>
</label>
</div>
<div class="form-check mt-2">
<label class="form-check-label">
Shake card when incorrect
<input
type="checkbox"
class="form-check-input"
v-model="shake"
true-value="true"
false-value="false"
@change="setCookie('shake', shake)"
/>
</label>
</div>
<div class="form-check mt-2">
<label class="form-check-label">
Pulse red when incorrect
<input
type="checkbox"
class="form-check-input"
v-model="pulse"
true-value="true"
false-value="false"
@change="setCookie('pulse', pulse)"
/>
</label>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-lg"
:class="currentTheme === 'dark' ? 'btn-outline-light' : 'btn-dark'"
data-dismiss="modal"
>
Close
</button>
</div>
</div>
</div>
</div>
<!-- end of the game modal -->
<div
class="modal fade"
id="gameOverModal"
data-backdrop="static"
data-keyboard="false"
tabindex="-1"
aria-labelledby="gameOverModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered">
<div
class="modal-content"
style="min-height: 400px"
:class="currentTheme"
>
<div class="modal-header">
<h5 class="modal-title">{{ gameOverHeader }}</h5>
</div>
<div class="modal-body">
<p>You got {{ correctGuesses }} right. You needed {{ esp }}.</p>
<p>{{ gameOverFeedback }}</p>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-lg"
:class="currentTheme === 'dark' ? 'btn-outline-success' : 'btn-success'"
data-dismiss="modal"
@click="startGame"
>
Play Again
</button>
<button
type="button"
class="btn btn-lg"
:class="currentTheme === 'dark' ? 'btn-outline-warning' : 'btn-warning'"
data-dismiss="modal"
@click="resetGame"
>
Exit
</button>
</div>
</div>
</div>
</div>
<!-- exit game modal -->
<div
class="modal fade"
id="exitModal"
data-backdrop="static"
data-keyboard="false"
tabindex="-1"
aria-labelledby="exitModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered">
<div
class="modal-content"
style="min-height: 400px"
:class="currentTheme"
>
<div class="modal-header">
<h5 class="modal-title" id="exitModalLabel">WAIT!</h5>
</div>
<div class="modal-body" id="exitModalBody">
<p>Are you sure you want to exit the game?</p>
<p>You may never know if you have Extra Sensory Perception!</p>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-lg"
:class="currentTheme === 'dark' ? 'btn-outline-success' : 'btn-success'"
data-dismiss="modal"
>
Continue
</button>
<button
type="button"
class="btn btn-lg"
:class="currentTheme === 'dark' ? 'btn-outline-danger' : 'btn-danger'"
data-dismiss="modal"
@click="resetGame"
>
Quit
</button>
</div>
</div>
</div>
</div>
<!-- card space -->
<div class="row mt-2">
<div
v-if="['init', 'guessing', 'round-one'].some(x => x === currentState)"
class="col-sm text-center"
>
<card-back
:theme="currentTheme"
:max="maxGuesses"
:num="numGuesses"
:correct="correctGuesses"
/>
</div>
<div
v-if="['guessed'].some(x => x === currentState)"
class="col-sm text-center"
>
<card-front
:card="currentCard"
:theme="currentTheme"
:class="(shaking ? 'shake shake-constant' : '') + ' ' + (pulsing ? 'c-pulse' : '')"
/>
</div>
</div>
<!-- message space -->
<div class="row mt-1 text-center">
<div class="col-sm">
<div v-cloak v-if="['init'].some(x => x === currentState)">
<p>
ESP, or Extrasensory Perception, and whether you have it, is the
goal of this experiment.
</p>
<h1>Are you ready?</h1>
</div>
<p v-if="['round-one'].some(x => x === currentState)">
I'm going to test you for extra sensory power. The symbol on the back
of this card matches one of the cards below. Clear your mind. When
you're ready, select the correct card.
</p>
<p v-if="['guessing', 'guessed'].some(x => x === currentState)">
{{ currentFeedback }}
</p>
</div>
</div>
<!-- card button space: HAVE TO V-IF THESE TO GET THE THEME TO PASS CORRECTLY-->
<div
class="row mt-1"
v-if="['guessing', 'round-one'].some(x => x === currentState)"
>
<div class="col-sm">
<div class="c-flexy">
<card-button
v-for="c of cards"
:card="c"
:theme="currentTheme"
@guessed="ZhuLi_DoTheThing"
/>
</div>
</div>
</div>
<!-- interface button space -->
<div class="row mt-1">
<div class="col-sm">
<div class="text-center">
<button
v-show="['init'].some(x => x === currentState)"
type="button"
class="btn btn-lg mx-auto"
:class="currentTheme === 'dark' ? 'btn-outline-success' : 'btn-success'"
@click="startGame"
>
Let us Begin
</button>
<button
v-show="numGuesses < maxGuesses"
type="button"
class="btn btn-lg mx-auto"
:class="currentTheme === 'dark' ? 'btn-outline-light' : 'btn-dark'"
data-toggle="modal"
data-target="#settingsModal"
>
Settings
</button>
<button
v-show="['guessed'].some(x => x === currentState) && numGuesses < maxGuesses"
type="button"
class="btn btn-lg mx-auto"
:class="currentTheme === 'dark' ? 'btn-outline-light' : 'btn-dark'"
@click="continueGame"
>
Continue
</button>
<button
v-show="['round-one', 'guessing', 'guessed'].some(x => x === currentState) && numGuesses < maxGuesses"
type="button"
class="btn btn-lg mx-auto"
:class="currentTheme === 'dark' ? 'btn-outline-warning' : 'btn-warning'"
data-toggle="modal"
data-target="#exitModal"
>
Exit
</button>
</div>
</div>
</div>
</div>
</div>
<audio src="./assets/notification.mp3" id="notificationSound"></audio>
<!-- JavaScript and dependencies -->
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- production version, optimized for size and speed -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"
integrity="sha256-ur/YlHMU96MxHEsy3fHGszZHas7NzH4RQlD4tDVvFhw="
crossorigin="anonymous"
></script>
<!-- custom scripts -->
<script src="./src/index.js"></script>
</body>
</html>