diff --git a/index.html b/index.html index c2637d2..4bdc041 100644 --- a/index.html +++ b/index.html @@ -9,14 +9,14 @@ - + - +

LiLa Games 💜

diff --git a/static/main.js b/static/main.js index c120c87..b198c33 100644 --- a/static/main.js +++ b/static/main.js @@ -3,16 +3,21 @@ const template = document.getElementById("game-template").content const serverdata = "/servers.json" var gamecontainer = document.getElementById("gamelist") +window.setInterval(PopulatePage, 10000, true) -async function populatePage() { - var request = await fetch(serverdata) +async function PopulatePage(reload) { + var request = await fetch(serverdata, {cache: "reload"}) var data = await request.json() console.log(data) + if (reload == true) { + gamecontainer.innerHTML = "" + } + data.forEach(server => { let clone = template.cloneNode(true); - let url = badgeurl.replace("##", server.id) + let url = badgeurl.replace("##", server.id ) clone.querySelector("#game-name").innerHTML = server.displayname clone.querySelector("#game-badge").src = url clone.querySelector("#game-url").innerHTML = server.serverurl