Skip to content

Commit

Permalink
fix webinterface popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Taraman17 committed Oct 23, 2023
1 parent f2a38bb commit 5d9af4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions public/js/gameserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function setupPage() {
setupNotLoggedIn();
});

$('.container-popup').css('display', 'none');
$('#container-popup').css('display', 'none');
}

function setupNotLoggedIn() {
Expand Down Expand Up @@ -131,15 +131,15 @@ 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) => {
if (socket.readyState != 1) { // if websocket not connected
if (action != 'update') {
setupPage();
}
$('.container-popup').hide();
$('#container-popup').hide();
}
}).fail((err) => {
let errorText = err.responseJSON.error;
Expand All @@ -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');
}
});
}
Expand Down Expand Up @@ -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);

Expand All @@ -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);
});
}
Expand Down
8 changes: 4 additions & 4 deletions public/js/onload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand All @@ -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!`);
}
Expand Down

0 comments on commit 5d9af4c

Please sign in to comment.