This commit is contained in:
William 2022-04-05 13:53:41 +00:00
parent 70bca1411b
commit 6f550c850c

View File

@ -12,13 +12,21 @@ Laster inn...
<script>
var hash = 0;
function main()
{
setInterval(function() {
updateTable()
}, 1000);
document.addEventListener('DOMContentLoaded', function() {
loop();
});
updateTable();
async function loop()
{
try {
await updateTable();
} catch (error) {
console.log(error);
}
setTimeout(function() {
loop();
}, 1000);
}
async function updateTable()
@ -40,15 +48,13 @@ async function updateTable()
table_html += "<table>";
table_html += "<tr>";
table_html += "<th>Navn</th>";
table_html += "<th>Runder</th>";
table_html += "<th>Bestetid</th>";
table_html += "</tr>";
data.forEach(element => {
table_html += "<tr>";
table_html += "<td>" + element.name + "</td>";
table_html += "<td>" + element.rounds + "</td>";
table_html += "<td>" + element.date + "</td>";
table_html += "<td>" + element.date.date + "</td>";
table_html += "</tr>";
});
@ -58,8 +64,4 @@ async function updateTable()
document.getElementById("ranking-table").innerHTML = table_html;
}
document.addEventListener('DOMContentLoaded', function() {
main();
});
</script>