-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaderboard.html
67 lines (59 loc) · 1.92 KB
/
leaderboard.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Midi Birds</title>
<meta name="description" content="A midi based bird interface">
<meta name="author" content="Tony Edwards">
<link rel="stylesheet" href="css/normalise.css">
<link rel="stylesheet" href="css/styles.css">
<style>
</style>
</head>
<body class="leaderboard">
<header>
<h1>All Time Leader board</h1>
<nav>
<ul>
<li><a href="index.html">Demo 0</a></li>
<li><a href="demo-1.html">Demo 1</a></li>
<li><a href="demo-2.html">Demo 2</a></li>
</ul>
</nav>
</header>
<main class="splash">
<div class="table-container">
<table>
<thead>
<tr>
<th>Position</th>
<th>Team Name</th>
<th>Event Name</th>
<th>Score</th>
</tr>
</thead>
<tbody id="leaderboard"></tbody>
</table>
</div>
</main>
<script src="js/dataStore.js"></script>
<script>
let data = [];
if (DataStore.loadLocally('highScores')){
let savedScores = DataStore.loadLocally('highScores');
data = JSON.parse(savedScores);
}
data.sort((a, b) => parseInt(b.score) - parseInt(a.score));
let el = document.getElementById('leaderboard');
data.forEach((entry, i) => {
el.innerHTML += `<tr>
<td>${i + 1}</td>
<td>${entry.teamName}</td>
<td>${entry.event}</td>
<td>${entry.score}</td>
</tr>`
});
</script>
</body>
</html>