MAPG-61 add onbeforeunload function to prevent accidental leave

This commit is contained in:
Bence Pőcze 2020-05-24 14:47:15 +02:00
parent 830989dc4c
commit 92408d6f02

View File

@ -35,7 +35,7 @@
Core.loadPositionInfo(Core.realPosition); Core.loadPositionInfo(Core.realPosition);
document.getElementById('currentRound').innerHTML = String(Core.rounds.length) + '/' + String(Core.NUMBER_OF_ROUNDS); document.getElementById('currentRound').innerHTML = String(Core.rounds.length) + '/' + String(Core.NUMBER_OF_ROUNDS);
document.getElementById('currentScoreSum').innerHTML = String(Core.scoreSum) + '/' + String((Core.rounds.length-1) * Core.MAX_SCORE); document.getElementById('currentScoreSum').innerHTML = String(Core.scoreSum) + '/' + String((Core.rounds.length - 1) * Core.MAX_SCORE);
} else { } else {
Core.startNewRound(); Core.startNewRound();
@ -286,7 +286,7 @@
fontFamily: 'Roboto', fontFamily: 'Roboto',
fontSize: '16px', fontSize: '16px',
fontWeight: '500', fontWeight: '500',
text: String(i+1) text: String(i + 1)
}); });
round.realMarker.setVisible(true); round.realMarker.setVisible(true);
round.guessMarker.setVisible(true); round.guessMarker.setVisible(true);
@ -470,4 +470,9 @@
document.getElementById('startNewGameButton').onclick = function () { document.getElementById('startNewGameButton').onclick = function () {
Core.startNewGame(); Core.startNewGame();
} }
window.onbeforeunload = function (e) {
e.preventDefault();
e.returnValue = '';
};
})(); })();