From fe711991f500178a8c649a225c7f3af04ae959b1 Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Thu, 2 Apr 2020 18:10:08 -0500 Subject: [PATCH] store initial state as soon as a new game is created --- js/pacosako_ui.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/pacosako_ui.js b/js/pacosako_ui.js index c6196cd..e762c09 100644 --- a/js/pacosako_ui.js +++ b/js/pacosako_ui.js @@ -792,6 +792,7 @@ $(function (){ let optIndex = $('#cb_select_game')[0].selectedIndex; if (optIndex === 0) { switchGameId(randomId()); + putState(); } else if (optIndex >= 1) { let opt = $('#cb_select_game option')[optIndex]; if (opt) { @@ -946,7 +947,12 @@ $(function (){ window.setTimeout(function(){ location.reload(); }, 4*3600*1000); const foundId = location.hash.match(/^#\/([0-9a-f]{16}\b)/); - switchGameId(foundId ? foundId[1] : randomId()); + if (foundId) { + switchGameId(foundId[1]); + } else { + switchGameId(randomId()); + putState(); + } /* Low-level commands to be run from the JS console */ window.Admin = {