-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
513 lines (495 loc) · 18.2 KB
/
index.html
File metadata and controls
513 lines (495 loc) · 18.2 KB
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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
<!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>Smartboard Games</title>
<meta name="description" content="A collection of simple educational games designed to run on smartboards, tablets, and phones.">
<meta name="tags" content="educational, games, smartboard, whiteboard, classroom, student, interactive">
<link rel="manifest" href="/manifest.json">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="icon" type="image/png" sizes="64x64" href="/ico/64.png">
<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=Roboto:wght@400;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/common.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.yiays.com/yiaycons/yiaycons.css">
<style>
a {
color: white!important;
}
.hero, nav, footer {
width: 100%;
box-sizing: border-box;
background: #242424;
}
.hero {
padding: 1em;
z-index: 100;
}
@media screen and (max-width: 40rem) {
.hero {
padding-top: 3rem;
}
}
nav, footer {
box-shadow: rgba(0,0,0,0.25) 0 0 0.25rem 0;
}
nav {
position: sticky;
top: 0;
z-index: 99;
}
main {
display: flex;
flex-direction: column;
flex-grow: 1;
align-items: center;
justify-content: center;
}
.hero h1 {
position: relative;
}
.hero h1 > span {
position: absolute;
font-size: 0.8rem;
color: #aaa;
color: var(--secondary);
}
.subhero {
display: flex;
flex-direction: column;
position: relative;
}
.subhero > :is(h1, h2, h3, h4, h5, h6), dialog > :is(h1, h2, h3, h4, h5, h6) {
margin:0.5em 3em;
}
.close {
position: absolute;
top: 0.5em;
right: 0.5em;
}
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
}
.categories {
display: block;
text-align: center;
padding: 0.5rem;
}
.category {
display: inline-block;
font-size: 0.9rem;
margin: 0.25rem;
min-width: 5em;
}
.category.active {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.c-trivia {
background-color: #863d0c;
background-color: var(--trivia);
}
.c-stem {
background-color: #1a547a;
background-color: var(--stem);
}
.c-geography {
background-color: #1d663c;
background-color: var(--geo);
}
.c-english {
background-color: #561f6d;
background-color: var(--eng);
}
.c-fun {
background-color: #6b6703;
background-color: var(--fun);
}
.c-other {
background-color: #aaa;
background-color: var(--secondary);
color: black !important;
color: var(--antitext) !important;
}
.games {
margin: 1rem;
max-width: 120rem;
}
.game {
position: relative;
flex-direction: column;
width: 19em;
min-height: 5.8em;
max-height: 12em;
margin: 1em;
padding: 3em 0.5em;
transform: scale(1);
font-size: 1em;
transition: transform 250ms;
}
.game::after {
content: attr(data-note);
position: absolute;
bottom: 0;
left: 0;
right: 0;
text-align: center;
margin: 0.5rem;
font-size: 0.8em;
font-weight: 400;
}
.game.hidden {
transform: scale(0);
animation: removeFromFlow 250ms forwards;
}
@keyframes removeFromFlow {
99% {
font-size: 1em;
}
100% {
font-size: 0px;
}
}
.game .badges {
position: absolute;
top: 0;
right: 0;
text-align: right;
margin: 0.5em;
}
.game .badges .btn {
background: none;
padding: 0.1em;
border: 2px solid #aaa;
border: 2px solid var(--secondary);
}
.game .background {
position: absolute;
top: 0.5rem;
left: 0.5rem;
opacity: 0.5;
z-index: -1;
font-size: 5em;
}
.game h3 {
font-size: 2em;
margin: 0;
}
.game h3, .game p {
flex-grow: 1;
}
.game sub {
font-style: italic;
}
</style>
</head>
<body>
<div class="hero">
<a href="/profile.html" class="profile online" data-username="not logged in" data-note="Improved login and sign up flow - 28/11/2025">
<i class="pfp">
<span class="icon icon-">user</span>
</i>
</a>
<h1>Smartboard Games<span class="ver"></span></h1>
<p>
A collection of simple educational games (and some tools), designed to be compatible with smartboards, tablets, and phones.
</p>
</div>
<nav class="categories">
<a href="#" class="btn category" data-filter="none">All</a>
<a href="#trivia" class="btn category c-trivia" data-filter="trivia">Trivia</a>
<a href="#stem" class="btn category c-stem" data-filter="stem">STEM</a>
<a href="#geography" class="btn category c-geography" data-filter="geography">Geography</a>
<a href="#english" class="btn category c-english" data-filter="english">English</a>
<a href="#fun" class="btn category c-fun" data-filter="fun">Fun</a>
<a href="#tool" class="btn category c-other" data-filter="tool"><span class="icon icon-cog"></span> Tool</a>
<a href="#leaderboard" class="btn category c-other" data-filter="leaderboard"><span class="icon icon-stats-bars2"></span> Leaderboard</a>
<a href="#group" class="btn category c-other" data-filter="group"><span class="icon icon-users"></span> Group</a>
<a href="#offline" class="btn category c-other" data-filter="offline"><span class="icon icon-floppy-disk"></span> Works offline</a>
</nav>
<main>
<section class="subhero" id="about-offline" hidden>
<h2>Smartboard Games: now available offline</h2>
<button id="hide-offline" class="close icon icon-cross nobtn" title="Close"></button>
<p>Install the Smartboard Games web app for easy access to Smartboard Games on the go.</p>
<button class="btn" id="install-offline" style="position:relative;margin:2em 0;padding-left:5em;">
<img src="/ico/256.png" width="256" height="256" style="position:absolute;transform:translateX(-10em);width:6em;height:auto;"/>
Install Smartboard Games
</button>
</section>
<div class="row games">
<a href="trivia/flashcards.html?quiz" class="btn game c-trivia" data-filter="trivia leaderboard offline" data-scope="flashcards_quiz_*" data-note="German added - 30/12/2025">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">✅</span>
<h3>Flashcards Quiz</h3>
<p>Choose the answer to flashcards with multiple choice questions</p>
</a>
<a href="fun/marbles.html" class="btn game c-fun" data-filter="fun offline" data-note="First 30 levels now available - 15/12/2025">
<p class="badges"></p>
<span class="background">🟡</span>
<h3>Marbles</h3>
<p>Untangle a jumble of marbles into colour groups</p>
</a>
<a href="english/spelling.html" class="btn game c-english online" data-filter="english leaderboard" data-scope="spelling_*" data-note="">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">🐝</span>
<h3>Spelling Bee</h3>
<p>Hear a word, see the definition, and try your best to spell it!</p>
</a>
<a href="stem/magicsquares.html" class="btn game c-stem" data-filter="stem offline" data-note="">
<p class="badges"></p>
<span class="background">🎩</span>
<h3>Magic Squares</h3>
<p>Solve randomly generated magic square maths puzzles</p>
</a>
<a href="english/anagrams.html" class="btn game c-english" data-filter="english leaderboard offline" data-scope="anagrams_*" data-note="Contractions now supported (apostrophies ignored) - 11/10/2025">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">🔀</span>
<h3>Anagrams</h3>
<p>Spell as many words as you can with the letters of another word</p>
</a>
<a href="stem/quickmaths.html?mode=0&difficulty=easy" class="btn game c-stem" data-filter="stem leaderboard offline" data-scope="quickmaths_0_*" data-note="Highscores reset, new scoring system - 15/02/2026">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">➕</span>
<h3>Quick Addition</h3>
<p>Quickfire maths questions with multiple choice answers</p>
</a>
<a href="stem/quickmaths.html?mode=1&difficulty=easy" class="btn game c-stem" data-filter="stem leaderboard offline" data-scope="quickmaths_1_*" data-note="Highscores reset, new scoring system - 15/02/2026">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">➖</span>
<h3>Quick Subtraction</h3>
<p>Quickfire maths questions with multiple choice answers</p>
</a>
<a href="stem/quickmaths.html?mode=2&difficulty=easy" class="btn game c-stem" data-filter="stem leaderboard offline" data-scope="quickmaths_2_*" data-note="Highscores reset, new scoring system - 15/02/2026">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">✖️</span>
<h3>Quick Multiplication</h3>
<p>Quickfire maths questions with multiple choice answers</p>
</a>
<a href="stem/quickmaths.html?mode=3&difficulty=easy" class="btn game c-stem" data-filter="stem leaderboard offline" data-scope="quickmaths_3_*" data-note="Highscores reset, new scoring system - 15/02/2026">
<p class="badges">
<button class="btn medals" title="Show leaderboard"><span class="icon icon-stats-bars2"></span></button>
</p>
<span class="background">➗</span>
<h3>Quick Division</h3>
<p>Quickfire maths questions with multiple choice answers</p>
</a>
<a href="english/storyshuffle.html" class="btn game c-english online" data-filter="english tool" data-note="">
<p class="badges">
<span class="icon icon-cog" title="Utility"></span>
</p>
<span class="background">📖</span>
<h3>Story Shuffle</h3>
<p>Interpret a set of 3 random images to inspire your next story</p>
</a>
<a href="trivia/flashcards.html" class="btn game c-trivia" data-filter="trivia tool offline" data-note="German added - 30/12/2025">
<p class="badges">
<span class="icon icon-cog" title="Utility"></span>
</p>
<span class="background">🎴</span>
<h3>Flashcards</h3>
<p>Train your memory with a variety of pre-made flashcards for learning languages</p>
</a>
<a href="geography/capitals.html" class="btn game c-geography online" data-filter="geography group" data-note="">
<p class="badges">
<span class="icon icon-users" title="Group game"></span>
</p>
<span class="background">🏙️</span>
<h3>Capital Cities</h3>
<p>Guess the capital for each country</p>
</a>
<a href="geography/capitals.html?mode=1" class="btn game c-geography online" data-filter="geography group" data-note="">
<p class="badges">
<span class="icon icon-users" title="Group game"></span>
</p>
<span class="background">🧳</span>
<h3>Countries</h3>
<p>Guess the country for each capital</p>
</a>
<a href="geography/capitals.html?mode=2" class="btn game c-geography online" data-filter="geography group" data-note="">
<p class="badges">
<span class="icon icon-users" title="Group game"></span>
</p>
<span class="background">🏳️</span>
<h3>Flags</h3>
<p>Guess the country for each flag</p>
</a>
<a href="trivia/5secondrule.html" class="btn game c-trivia" data-filter="trivia group offline" data-note="">
<p class="badges">
<span class="icon icon-users" title="Group game"></span>
</p>
<span class="background">⏱️</span>
<h3>5 Second Rule</h3>
<p>Quickfire questions with a 5 second time limit</p>
</a>
</div>
</main>
<dialog id="medals" closedby="any">
<h2>Earned medals for game</h2>
<button autofocus class="close icon icon-cross nobtn" title="Close" onclick="medalsDialog.close()"></button>
<p>No medals earned for this game yet.</p>
</dialog>
<footer>
<span>
Created by <a href="https://yiays.com">Yiays</a>
</span>
</footer>
<script src="//cdn.yiays.com/jquery-3.7.1.min.js"></script>
<script src="/common.js"></script>
<script>
const medalsDialog = document.getElementById('medals');
let installprompt = null;
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
installprompt = e;
document.getElementById('about-offline').removeAttribute('hidden');
});
document.getElementById('hide-offline').addEventListener('click', (e) => {
document.getElementById('about-offline').setAttribute('hidden', '');
});
document.getElementById('install-offline').addEventListener('click', (e) => {
installprompt.prompt();
document.getElementById('about-offline').setAttribute('hidden', '');
});
let badgeCache;
if(localStorage.getItem('badges')) {
badgeCache = JSON.parse(localStorage.getItem('badges'));
}
$().ready(() => {
$('.category').on('click', (e) => {
filter(e.target.dataset.filter);
});
$('.medals').on('click', (e) => {
e.preventDefault();
const el = e.target.parentElement.parentElement;
showMedals($(el).find('h3').text(), el.dataset.scope);
return false;
})
function filter(id) {
$('.game').addClass('hidden');
if(id == 'none'){
$('.game').removeClass('hidden');
}else{
$(`.game[data-filter*=${id}]`).removeClass('hidden');
}
$('.category.active').removeClass('active');
$(`.category.c-${id}`).addClass('active');
}
filter(location.hash?location.hash.substr(1):'none');
// Check if the leaderboard cache needs to be updated
if(username) {
if(badgeCache) {
if(badgeCache.username == username) {
// Check if the
$.get('https://highscore.yiays.com/?modified')
.done((data) => update_badges(badgeCache.modified, data))
} else {
update_badges();
}
} else {
update_badges()
}
} else {
addLeaderboardMedals();
}
});
// Retrieve the leaderboards
function update_badges(cacheDate=0, badgeDate=Infinity) {
if(cacheDate < badgeDate) {
badgeCache = {username: username, modified: (new Date()).valueOf()}
$('.game[data-scope]').each((_,el) => {
$.getJSON(`https://highscore.yiays.com/?scope=${el.dataset.scope}&username=${username}`)
.done((data) => {
badgeCache[el.dataset.scope] = data;
})
.then(() => localStorage.setItem('badges', JSON.stringify(badgeCache)));
});
}
addLeaderboardMedals();
}
// Show earned badges
function addLeaderboardMedals() {
$('.game[data-scope]').each((_,el) => {
let data;
if(badgeCache && el.dataset.scope in badgeCache) data = badgeCache[el.dataset.scope];
else data = {};
let medalButton = $(el).find('.medals');
const medalCounts = medalCounter(Object.entries(data));
let shown = 0;
Object.entries(medalCounts).forEach((medal) => {
if(medal[1] > 0 || (medal[0] == 4 && shown == 0)) {
medalButton.append(` ${placeEmoji[medal[0]]}${medal[1]}`);
shown++;
}
});
});
}
function diffsorter(arr) {
const order = ['baby','easy','medium','hard','harder'];
return arr.sort((a, b) => {
const indexA = order.indexOf(a[0].toLowerCase());
const indexB = order.indexOf(b[0].toLowerCase());
if (indexA === -1 && indexB === -1) {
return a[0].localeCompare(b[0]);
} else if (indexA === -1) {
return 1;
} else if (indexB === -1) {
return -1;
} else {
return indexA - indexB;
}
});
}
function medalCounter(arr) {
let result = {1:0, 2:0, 3:0, 4:0}
arr.forEach((place) => {
if(place[1] < 4) result[place[1]]++;
else result[4]++;
});
return result;
}
const placeName = {1:'1st', 2:'2nd', 3:'3rd'};
const placeEmoji = {1:'🥇', 2:'🥈', 3:'🥉', 4:'🏅'};
function showMedals(title, scope) {
$(medalsDialog).find('h2').text(`Earned medals for ${title}`);
const dest = $(medalsDialog).find('p');
medalsDialog.showModal();
dest.empty();
if(!badgeCache) {
dest.text("Sign in to see your earned medals in this game.");
dest.append(`<br/><a href="/profile.html" class="btn online">Profile</a>`);
return;
}
if(scope in badgeCache) {
var sorted = diffsorter(Object.entries(badgeCache[scope]));
sorted.forEach((place) => {
if(place[1] <= 3)
dest.append(`${place[0]}: ${placeEmoji[place[1]]} ${placeName[place[1]]} place<br/>`);
else
dest.append(`${place[0]}: 🏅 ${place[1]}th place<br/>`);
});
if(sorted.length) return;
}
dest.text("You don't have any earned medals in this game yet.");
}
</script>
</body>
</html>