From 1e7b10668973c1d417fb1e245a8d25a622a7730f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sat, 30 May 2020 18:14:50 +0200 Subject: [PATCH] MAPG-72 prevent to show 'beforeonload' confirmation panel if we already have the real position (guess is evaluated) --- public/static/js/game.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/static/js/game.js b/public/static/js/game.js index f13460a..14e5f79 100644 --- a/public/static/js/game.js +++ b/public/static/js/game.js @@ -197,7 +197,7 @@ scoreBar.style.backgroundColor = scoreBarProperties.backgroundColor; scoreBar.style.width = scoreBarProperties.width; - if (Core.rounds.length == Core.NUMBER_OF_ROUNDS) { + if (Core.rounds.length === Core.NUMBER_OF_ROUNDS) { document.getElementById('continueButton').style.display = 'none'; document.getElementById('showSummaryButton').style.display = 'block'; } @@ -444,6 +444,10 @@ } window.onbeforeunload = function (e) { + if (Core.rounds[Core.rounds.length - 1].position) { + return; + } + e.preventDefault(); e.returnValue = ''; };