store initial state as soon as a new game is created

This commit is contained in:
Jesse D. McDonald 2020-04-02 18:10:08 -05:00
parent e1722cf589
commit fe711991f5
1 changed files with 7 additions and 1 deletions

View File

@ -792,6 +792,7 @@ $(function (){
let optIndex = $('#cb_select_game')[0].selectedIndex; let optIndex = $('#cb_select_game')[0].selectedIndex;
if (optIndex === 0) { if (optIndex === 0) {
switchGameId(randomId()); switchGameId(randomId());
putState();
} else if (optIndex >= 1) { } else if (optIndex >= 1) {
let opt = $('#cb_select_game option')[optIndex]; let opt = $('#cb_select_game option')[optIndex];
if (opt) { if (opt) {
@ -946,7 +947,12 @@ $(function (){
window.setTimeout(function(){ location.reload(); }, 4*3600*1000); window.setTimeout(function(){ location.reload(); }, 4*3600*1000);
const foundId = location.hash.match(/^#\/([0-9a-f]{16}\b)/); 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 */ /* Low-level commands to be run from the JS console */
window.Admin = { window.Admin = {