modify refresh behavior
All checks were successful
ci/woodpecker/push/netlify Pipeline was successful
All checks were successful
ci/woodpecker/push/netlify Pipeline was successful
This commit is contained in:
parent
8226f440ef
commit
bbd794d44e
2 changed files with 10 additions and 5 deletions
|
@ -9,14 +9,14 @@
|
|||
<link rel='stylesheet' type='text/css' media='screen' href='/static/style.css'>
|
||||
<link rel="preload" href="/static/open-sans-v35-latin-regular.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<script src='/static/main.js' defer></script>
|
||||
<meta http-equiv="refresh" content="30" />
|
||||
<!-- <meta http-equiv="refresh" content="30" /> -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
</head>
|
||||
|
||||
<body onload="javascript:populatePage()">
|
||||
<body onload="javascript:PopulatePage(false)">
|
||||
<h1>LiLa Games 💜</h1>
|
||||
|
||||
<div id="gamelist" class="flex">
|
||||
|
|
|
@ -3,12 +3,17 @@ 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue