added PBs to userscores

This commit is contained in:
2026-05-29 22:48:00 +01:00
parent 4f6f86c0f8
commit f526a0772f
5 changed files with 32 additions and 20 deletions
+9 -5
View File
@@ -5,10 +5,13 @@
</head>
<body>
<h1>Hiscores</h1>
<p>Highest achieved numbers before returning to 0</p>
<div id="hiscore-table"></div>
<h1>Loscores</h1>
<p>Highest number of consecutive resets to 0</p>
<div id="loscore-table"></div>
<h1>Pingscores</h1>
<h1>Userscores</h1>
<p>Total number of resets and personal bests of each username</p>
<div id="pingscore-table"></div>
</body>
<style>
@@ -57,14 +60,15 @@
tableDiv2.appendChild(table2);
const tableDiv3 = document.getElementById("pingscore-table");
const table3 = document.createElement("table");
table3.innerHTML = `<tr><th>Rank</th><th>Score</th><th>Name</th></tr>`;
table3.innerHTML = `<tr><th>Rank</th><th>Name</th><th>Reset count</th><th>PB</th></tr>`;
let pingscores = data.pingscores;
let sorted = Object.entries(pingscores).sort(([,a],[,b]) => b - a)
sorted.forEach(([person,score],index) => {
let sorted = Object.entries(pingscores).sort(([,[a,]],[,[b,]]) => b - a)
sorted.forEach(([person,scores],index) => {
table3.innerHTML += `<tr>
<td>#${index + 1}</td>
<td>${validate_data(person)}</td>
<td>${validate_data(score)}</td>
<td>${validate_data(scores[0])}</td>
<td>${validate_data(scores[1])}</td>
</tr>`;
});
tableDiv3.appendChild(table3);