From: Benjamin Auder Date: Sun, 18 Nov 2018 12:50:22 +0000 (+0100) Subject: Attempt to prevent other tabs new games while playing (...) X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/images/css/img/current/common.css?a=commitdiff_plain;h=cd3174c5a6c2a3f520cc8ff5974701996119dce3;p=vchess.git Attempt to prevent other tabs new games while playing (...) --- diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 9e00d12b..1e68fe63 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -466,6 +466,13 @@ Vue.component('my-game', { this.score = "*"; if (mode=="human" && !oppId) { + const storageVariant = localStorage.getItem("variant"); + if (!!storageVariant && storageVariant !== variant) + { + // TODO: find a better way to ensure this. Newgame system is currently a mess. + alert("Finish your " + storageVariant + " game first!"); + return; + } // Send game request and wait.. this.clearStorage(); //in case of try {