Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix webinterface popup #39

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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