Ajout panel + récup infos depuis SQL + fix noms de fichiers

This commit is contained in:
Zachary Guénot
2023-05-10 01:53:55 +02:00
parent 172f811e91
commit de01c981f8
14 changed files with 162 additions and 58 deletions

19
public/panel/script.js Normal file
View File

@@ -0,0 +1,19 @@
const xhr = new XMLHttpRequest()
const url = 'https://angels-dev.fr/twitch/panel/data'
xhr.open('GET', url, true)
xhr.onload = () => {
if (xhr.status === 200) {
let data = JSON.parse(xhr.responseText)
let tbodyRef = document.getElementById('table').getElementsByTagName('tbody')[0]
for (let entry of data.scoreboard) {
let row = tbodyRef.insertRow()
row.insertCell().appendChild(document.createTextNode(entry.user_name))
row.insertCell().appendChild(document.createTextNode(entry.count))
}
} else console.error('Error:', xhr.statusText)
}
xhr.onerror = () => { console.error('Error:', xhr.statusText) }
xhr.send()