redirection blockchain

This commit is contained in:
Theouche 2024-08-22 15:41:43 +02:00
parent c72986748e
commit c85c5b50a9
2 changed files with 22 additions and 29 deletions

View File

@ -25,6 +25,11 @@ document.addEventListener('DOMContentLoaded', () => {
const quickMatchButton = document.getElementById('quick-match'); const quickMatchButton = document.getElementById('quick-match');
const tournamentButton = document.getElementById('tournament'); const tournamentButton = document.getElementById('tournament');
/* const modal = document.getElementById("myModal");
const btn = document.getElementById("myBtn");
const span = document.getElementsByClassName("close")[0];
const jsonContent = document.getElementById("jsonContent"); */
let socket; let socket;
let token; let token;
let gameState; let gameState;
@ -168,7 +173,7 @@ document.addEventListener('DOMContentLoaded', () => {
function startQuickMatch() { function startQuickMatch() {
gameContainer.style.display = 'flex'; gameContainer.style.display = 'flex';
logo.style.display = 'none'; logo.style.display = 'none';
menuButton.style.display = 'none'; //menuButton.style.display = 'none';
formBlock.style.display = 'none'; formBlock.style.display = 'none';
startWebSocketConnection(token); startWebSocketConnection(token);
} }
@ -316,31 +321,32 @@ document.addEventListener('DOMContentLoaded', () => {
// Afficher le tableau sélectionné // Afficher le tableau sélectionné
if (tableId === 'player-list') { if (tableId === 'player-list') {
console.log('Showing player list'); console.log('Showing player list 2');
//if (playerList) { //if (playerList) {
playerList.style.display = 'block'; playerList.style.display = 'block';
fetchPlayers(); fetchPlayers();
//} //}
} else if (tableId === 'match-list') { } else if (tableId === 'match-list') {
console.log('Showing match list'); console.log('Showing match list 2');
//if (matchList) //if (matchList)
matchList.style.display = 'block'; matchList.style.display = 'block';
fetchMatches(); fetchMatches();
} else if (tableId === 'tournoi-list') { } else if (tableId === 'tournoi-list') {
console.log('Showing tournoi list'); console.log('Showing tournoi list 2');
//if (tournoiList) //if (tournoiList)
tournoiList.style.display = 'block'; tournoiList.style.display = 'block';
fetchTournois(); fetchTournois();
} else if (tableId === blockchainList) { } else if (tableId === 'blockchain-list') {
console.log('Showing tournoi list'); console.log('Opening external page in a new tab');
blockchainList.style.display = 'block'; window.open('https://sepolia.etherscan.io/address/0x078d04eb6fb97cd863361fc86000647dc876441b', '_blank');
fetch('/web3/') /* fetch('/web3/')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
jsonContent.textContent = JSON.stringify(data, null, 2); console.log('ok here !!');
//modal.style.display = "block"; jsonContent.textContent = JSON.stringify(data, null, 2);
}); }); */
} }
// Masquer le menu après la sélection // Masquer le menu après la sélection
if (dropdownMenu) { if (dropdownMenu) {
dropdownMenu.style.display = 'none'; dropdownMenu.style.display = 'none';
@ -485,15 +491,11 @@ document.addEventListener('DOMContentLoaded', () => {
////////////////////////////// END STARS //////////////////////////////// ////////////////////////////// END STARS ////////////////////////////////
/* btn.onclick = function() {
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
var jsonContent = document.getElementById("jsonContent");
btn.onclick = function() {
fetch('/web3/') fetch('/web3/')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
console.log('ok here !!');
jsonContent.textContent = JSON.stringify(data, null, 2); jsonContent.textContent = JSON.stringify(data, null, 2);
modal.style.display = "block"; modal.style.display = "block";
}); });
@ -507,7 +509,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (event.target == modal) { if (event.target == modal) {
modal.style.display = "none"; modal.style.display = "none";
} }
} } */
////////////////////////////// BEG LANGAGE //////////////////////////////// ////////////////////////////// BEG LANGAGE ////////////////////////////////
const translations = { const translations = {

View File

@ -55,15 +55,6 @@
<label for="font-size-slider">Taille:</label> <label for="font-size-slider">Taille:</label>
<input type="range" id="font-size-slider" min="12" max="36" value="16"> <input type="range" id="font-size-slider" min="12" max="36" value="16">
</div> </div>
<button id="myBtn">Resultat</button>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<pre id="jsonContent"></pre>
</div>
</div>
<div class="container" id="block-form"> <div class="container" id="block-form">
<h1 id="welcome">BIENVENUE DANS LE PONG 42</h1> <h1 id="welcome">BIENVENUE DANS LE PONG 42</h1>