From cd3174c5a6c2a3f520cc8ff5974701996119dce3 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sun, 18 Nov 2018 13:50:22 +0100
Subject: [PATCH] Attempt to prevent other tabs new games while playing (...)

---
 public/javascripts/components/game.js | 7 +++++++
 1 file changed, 7 insertions(+)

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 {
-- 
2.44.0