From 5d9af4cdec435b0a2192e3f89a4ce1cc67181801 Mon Sep 17 00:00:00 2001 From: Taraman17 Date: Mon, 23 Oct 2023 21:56:25 +0200 Subject: [PATCH] fix webinterface popup --- public/js/gameserver.js | 16 ++++++++-------- public/js/onload.js | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/public/js/gameserver.js b/public/js/gameserver.js index 18cdbd5..8f6b0ae 100644 --- a/public/js/gameserver.js +++ b/public/js/gameserver.js @@ -82,7 +82,7 @@ function setupPage() { setupNotLoggedIn(); }); - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); } function setupNotLoggedIn() { @@ -131,7 +131,7 @@ function clickButton(aButton) { action = aButton.value.toLowerCase(); $('#popupCaption').text(`${titles[action]}`); $('#popupText').text('Moment bitte!'); - $('.container-popup').css('display', 'flex'); + $('#container-popup').css('display', 'flex'); startMap = document.getElementById('mapAuswahl').value; sendGet(`${apiPath}/control/${action}`, `startmap=${startMap}`).done((data) => { @@ -139,7 +139,7 @@ function clickButton(aButton) { if (action != 'update') { setupPage(); } - $('.container-popup').hide(); + $('#container-popup').hide(); } }).fail((err) => { let errorText = err.responseJSON.error; @@ -151,7 +151,7 @@ function clickButton(aButton) { window.location.href = './notauth.htm'; } if (socket.readyState != 1) { - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); } }); } @@ -226,14 +226,14 @@ function changeMap(event) { let map = event.currentTarget.firstElementChild.textContent; $('#mapSelector').hide('fast'); $('#popupCaption').text(titles['mapchange']); - $('.container-popup').css('display', 'flex'); + $('#container-popup').css('display', 'flex'); sendGet(`${apiPath}/control/changemap`, `map=${map}`, (data) => { if (data.success) { $('#popupText').html(`Changing map to ${map}`); } else { $('#popupText').html(`Mapchange failed!`); window.setTimeout(() => { - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); window.location.href = './notauth.htm'; }, 2000); @@ -245,9 +245,9 @@ function restartRound() { sendGet(`${apiPath}/rcon`, `message=mp_restartgame 1`, (data) => { $('#popupCaption').text(`Restart Round`); $('#popupText').html(`Round Restarted!`); - $('.container-popup').css('display', 'flex'); + $('#container-popup').css('display', 'flex'); window.setTimeout(() => { - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); }, 1000); }); } diff --git a/public/js/onload.js b/public/js/onload.js index 4ef7c00..110f4c0 100644 --- a/public/js/onload.js +++ b/public/js/onload.js @@ -67,17 +67,17 @@ $(document).ready(() => { if (data.payload.state == 'start') { $('#popupCaption').text(`${titles[data.payload.operation]}`); $('#popupText').text('Moment bitte!'); - $('.container-popup').css('display', 'flex'); + $('#container-popup').css('display', 'flex'); } else if (data.payload.state == 'end' && data.payload.operation != 'start') { $('#popupText').html(`${data.payload.operation} success!`); setTimeout(() => { - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); setupPage(); }, 1500); } else if (data.payload.state == 'fail') { $('#popupText').html(`${data.payload.operation} failed!`); setTimeout(() => { - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); if (data.payload.operation != 'update') { window.location.href = './notauth.htm'; } @@ -88,7 +88,7 @@ $(document).ready(() => { } else if (data.type == "mapchange") { if (data.payload.success$ && $('#popupCaption').text() == 'Changing Map') { socket.send('infoRequest'); - $('.container-popup').css('display', 'none'); + $('#container-popup').css('display', 'none'); } else if (!data.payload.success) { $('#popupText').html(`Mapchange failed!`); }