1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-23 21:48:52 +02:00

Fix errors and better tab usage

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-22 20:41:16 +01:00
parent bde3758c50
commit 93a71fb561
4 changed files with 249 additions and 28 deletions

View File

@ -4,6 +4,18 @@ const sockets = {}
const messages = document.getElementById('messages')
document.addEventListener('DOMContentLoaded', () => {
if (document.location.hash) {
document.querySelectorAll('button[data-bs-toggle="tab"]').forEach(elem => {
if ('#' + elem.innerText.toLowerCase() === document.location.hash.toLowerCase()) {
elem.click()
}
})
}
document.querySelectorAll('button[data-bs-toggle="tab"]').forEach(
elem => elem.addEventListener(
'click', () => document.location.hash = '#' + elem.innerText.toLowerCase()))
for (let tournament of tournaments) {
let socket = new WebSocket(
'ws://' + window.location.host + '/ws/draw/' + tournament.id + '/'
@ -24,9 +36,8 @@ document.addEventListener('DOMContentLoaded', () => {
}
function draw_start(data) {
fetch(`/draw/content/${tournament.id}/`).then(resp => resp.text()).then(text => {
document.getElementById(`tab-${tournament.id}-pane`).innerHTML = text
})
document.getElementById(`banner-not-started-${tournament.id}`).classList.add('d-none')
document.getElementById(`draw-content-${tournament.id}`).classList.remove('d-none')
}
socket.addEventListener('message', e => {