From bcfbae4bc0b68589dda7ccb95a0c91a1cbd9426c Mon Sep 17 00:00:00 2001 From: snorrehaha <snorrhh@stud.ntnu.no> Date: Thu, 7 Nov 2024 00:28:43 +0100 Subject: [PATCH] Now swithcing between forum and game works , removded unecessary functions --- Project/static/game.html | 2 +- Project/static/js/game.js | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Project/static/game.html b/Project/static/game.html index f04fb36..eb981e8 100644 --- a/Project/static/game.html +++ b/Project/static/game.html @@ -36,7 +36,7 @@ <!--This is probably js instead of a list with links--> <ul> <li><a id="gamesButton" href="/games">Games</a> </li> - <li><a id="gameButton" href="#">Game</a></li> + <li><a id="gameButton" href="">Game</a></li> <li><a id="forumButton" href="#">Forum</a></li> </ul> diff --git a/Project/static/js/game.js b/Project/static/js/game.js index f626388..49a7769 100644 --- a/Project/static/js/game.js +++ b/Project/static/js/game.js @@ -18,7 +18,6 @@ const eSubmitCommentButton = document.getElementById('submitComment'); const eComment = document.getElementById('comment'); const forumButton = document.getElementById('forumButton'); const sectionMain = document.getElementById('sectionMain'); -const gameButton = document.getElementById('gameButton'); const loginButton = document.getElementById('loginButton'); const userPageButton = document.getElementById('userPageButton'); @@ -132,7 +131,7 @@ function getUserGameData(token) { } //executing comments and reviews showReviews(); -showComments(); + forumButton.addEventListener('click', function (event) { @@ -166,16 +165,7 @@ forumButton.addEventListener('click', function (event) { showComments(); }); -gameButton.addEventListener('click', async (e) => { - e.preventDefault(); - sectionMain.innerHTML = ''; - getGameData(); - if (currentUser && currentUser.idToken) { - getUserGameData(currentUser.idToken); - } else { - console.error("User token is missing or invalid."); - } -}); + // Submit review and rating eFormButton.addEventListener('click', async (e) => { -- GitLab