-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (40 loc) · 1.31 KB
/
script.js
File metadata and controls
46 lines (40 loc) · 1.31 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
$(document).ready(function(){
// Add service worker for offline playing
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
.then(registration =>
{
console.log("Service Worker registered");
}).catch(err => {
console.log('Service Worker registration failed: ', err);
})
}
// Create a game
game = new Game();
// Add data
game.addData(data);
for (id in game.data.groups)
{
var group = game.data.groups[id];
// Display groups
$('div#list').append(
'<div class="option-wrapper">' +
'<div class="option">' +
'<div class="title">' + group.name + '</div>' +
'<div class="info">' +
'<div class="infoElement" onclick="window.location=\'view/?g=' + group.id + '\';">' +
'<i class="fa-solid fa-flag"></i>' +
'<div class="infoNumber">' + group.getNumberOfElements() + '</div>' +
'</div>' +
'<div class="infoElement">' +
'<i class="fa-solid fa-bolt gold"></i>' +
'<div class="infoNumber">' + group.getLongestStreak() + '</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="button" onclick="window.location=\'play/?g=' + group.id + '\';">' +
'<i class="fa-solid fa-play fa-3x"></i>' +
'</div>' +
'</div class="option-wrapper">');
}
})