Ajout panel + récup infos depuis SQL + fix noms de fichiers
This commit is contained in:
16
public/panel/panel.css
Normal file
16
public/panel/panel.css
Normal file
@@ -0,0 +1,16 @@
|
||||
p {
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
th {
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
td {
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
table .center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
16
public/panel/panel.html
Normal file
16
public/panel/panel.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
|
||||
<script src="https://angels-dev.fr/twitch/panel/script.js"></script>
|
||||
<link rel="stylesheet" href="https://angels-dev.fr/twitch/panel/panel.css">
|
||||
|
||||
<title>Panel Laytho</title>
|
||||
<p>Classement des Daily Arrows</p>
|
||||
<table id="table" class="center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Pseudo</th>
|
||||
<th scope="col">Daily Arrows</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
19
public/panel/script.js
Normal file
19
public/panel/script.js
Normal 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()
|
||||
Reference in New Issue
Block a user