mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2025-12-16 14:07:49 +01:00
hideAllTable()
This commit is contained in:
parent
7670e6649e
commit
c72986748e
@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const playerList = document.getElementById('player-list');
|
||||
const matchList = document.getElementById('match-list');
|
||||
const tournoiList = document.getElementById('tournoi-list');
|
||||
const blockchainList = document.getElementById('blockchain-list');
|
||||
const dropdownMenu = document.getElementById('dropdown-menu');
|
||||
|
||||
const pongElements = document.getElementById('pong-elements');
|
||||
@ -284,18 +285,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
console.log('Menu toggled');
|
||||
if (dropdownMenu.style.display === "block") {
|
||||
dropdownMenu.style.display = "none";
|
||||
hideAllTables();
|
||||
} else {
|
||||
dropdownMenu.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
function hideAllTables(){
|
||||
if (playerList) playerList.style.display = 'none';
|
||||
if (matchList) matchList.style.display = 'none';
|
||||
if (tournoiList) tournoiList.style.display = 'none';
|
||||
if (blockchainList) blockchainList.style.display = 'none';
|
||||
}
|
||||
|
||||
const links = document.querySelectorAll('#dropdown-menu a');
|
||||
|
||||
links.forEach(link => {
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault(); // Empêche le comportement par défaut du lien
|
||||
const tableId = link.getAttribute('data-table');
|
||||
console.log("Here !!!!!!!!!!!! NNNNNNNN");
|
||||
//console.log("Here !!!!!!!!!!!! NNNNNNNN");
|
||||
showTable(tableId);
|
||||
});
|
||||
});
|
||||
@ -303,9 +312,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
function showTable(tableId) {
|
||||
// Masquer tous les tableaux
|
||||
console.log('Entering showTable', tableId);
|
||||
if (playerList) playerList.style.display = 'none';
|
||||
if (matchList) matchList.style.display = 'none';
|
||||
if (tournoiList) tournoiList.style.display = 'none';
|
||||
hideAllTables();
|
||||
|
||||
// Afficher le tableau sélectionné
|
||||
if (tableId === 'player-list') {
|
||||
@ -324,6 +331,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
//if (tournoiList)
|
||||
tournoiList.style.display = 'block';
|
||||
fetchTournois();
|
||||
} else if (tableId === blockchainList) {
|
||||
console.log('Showing tournoi list');
|
||||
blockchainList.style.display = 'block';
|
||||
fetch('/web3/')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
jsonContent.textContent = JSON.stringify(data, null, 2);
|
||||
//modal.style.display = "block";
|
||||
});
|
||||
}
|
||||
// Masquer le menu après la sélection
|
||||
if (dropdownMenu) {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Pong Game</title>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'styles.css' %}?v=2">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'styles.css' %}?v=3">
|
||||
<div class="logo">
|
||||
<img src="{% static 'logo-42-perpignan.png' %}" alt="Logo">
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user