From 4910fa7a8827e2a8edd7d30a877888899d091da9 Mon Sep 17 00:00:00 2001 From: Andrio Celos Date: Fri, 23 Jun 2023 10:10:04 +1000 Subject: [PATCH] Fix script errors and back navigation not closing the help dialog --- TableturfBattleClient/src/app.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/TableturfBattleClient/src/app.ts b/TableturfBattleClient/src/app.ts index cd39891..e748fee 100644 --- a/TableturfBattleClient/src/app.ts +++ b/TableturfBattleClient/src/app.ts @@ -541,6 +541,7 @@ function processUrl() { if (location.pathname.endsWith('/help') || location.hash == '#help') helpDialog.showModal(); else { + helpDialog.close(); const m = /[/#](?:(game)|replay)\/([A-Za-z0-9+/=\-_]+)$/.exec(location.toString()); if (m) { if (m[1]) @@ -650,10 +651,12 @@ Promise.all([ cardDatabase.loadAsync().then(initCardDatabase), stageDatabase.loa setLoadingMessage(null); if (initialiseCallback) initialiseCallback(); - }, () => { - preGameLoadingSection.hidden = true; - communicationError('Unable to load game data from the server.', false); - }); + }, initError); + +function initError() { + preGameLoadingSection.hidden = true; + communicationError('Unable to load game data from the server.', false); +} showPage('preGame'); -processUrl(); +window.addEventListener('load', processUrl);