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 playerList = document.getElementById('player-list');
|
||||||
const matchList = document.getElementById('match-list');
|
const matchList = document.getElementById('match-list');
|
||||||
const tournoiList = document.getElementById('tournoi-list');
|
const tournoiList = document.getElementById('tournoi-list');
|
||||||
|
const blockchainList = document.getElementById('blockchain-list');
|
||||||
const dropdownMenu = document.getElementById('dropdown-menu');
|
const dropdownMenu = document.getElementById('dropdown-menu');
|
||||||
|
|
||||||
const pongElements = document.getElementById('pong-elements');
|
const pongElements = document.getElementById('pong-elements');
|
||||||
@ -284,18 +285,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
console.log('Menu toggled');
|
console.log('Menu toggled');
|
||||||
if (dropdownMenu.style.display === "block") {
|
if (dropdownMenu.style.display === "block") {
|
||||||
dropdownMenu.style.display = "none";
|
dropdownMenu.style.display = "none";
|
||||||
|
hideAllTables();
|
||||||
} else {
|
} else {
|
||||||
dropdownMenu.style.display = "block";
|
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');
|
const links = document.querySelectorAll('#dropdown-menu a');
|
||||||
|
|
||||||
links.forEach(link => {
|
links.forEach(link => {
|
||||||
link.addEventListener('click', (event) => {
|
link.addEventListener('click', (event) => {
|
||||||
event.preventDefault(); // Empêche le comportement par défaut du lien
|
event.preventDefault(); // Empêche le comportement par défaut du lien
|
||||||
const tableId = link.getAttribute('data-table');
|
const tableId = link.getAttribute('data-table');
|
||||||
console.log("Here !!!!!!!!!!!! NNNNNNNN");
|
//console.log("Here !!!!!!!!!!!! NNNNNNNN");
|
||||||
showTable(tableId);
|
showTable(tableId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -303,9 +312,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
function showTable(tableId) {
|
function showTable(tableId) {
|
||||||
// Masquer tous les tableaux
|
// Masquer tous les tableaux
|
||||||
console.log('Entering showTable', tableId);
|
console.log('Entering showTable', tableId);
|
||||||
if (playerList) playerList.style.display = 'none';
|
hideAllTables();
|
||||||
if (matchList) matchList.style.display = 'none';
|
|
||||||
if (tournoiList) tournoiList.style.display = 'none';
|
|
||||||
|
|
||||||
// Afficher le tableau sélectionné
|
// Afficher le tableau sélectionné
|
||||||
if (tableId === 'player-list') {
|
if (tableId === 'player-list') {
|
||||||
@ -324,6 +331,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
//if (tournoiList)
|
//if (tournoiList)
|
||||||
tournoiList.style.display = 'block';
|
tournoiList.style.display = 'block';
|
||||||
fetchTournois();
|
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
|
// Masquer le menu après la sélection
|
||||||
if (dropdownMenu) {
|
if (dropdownMenu) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Pong Game</title>
|
<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">
|
<div class="logo">
|
||||||
<img src="{% static 'logo-42-perpignan.png' %}" alt="Logo">
|
<img src="{% static 'logo-42-perpignan.png' %}" alt="Logo">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user