Fix current page in sockets.js
[vchess.git] / client / src / main.js
index 08893db..9d2e73d 100644 (file)
@@ -12,6 +12,19 @@ new Vue({
   },
   created: function() {
     window.doClick = (elemId) => { document.getElementById(elemId).click() };
-    store.initialize();
+    document.addEventListener("keydown", (e) => {
+      if (e.code === "Escape")
+      {
+        let modalBoxes = document.querySelectorAll("[id^='modal']");
+        modalBoxes.forEach(m => {
+          if (m.checked)
+            m.checked = false;
+        });
+      }
+    });
+    // TODO: why is this wrong? (Maybe because $route still uninitialized?)
+    //store.initialize(this.$route.path);
+    store.initialize(window.location.href.split("#")[1].split("?")[0]);
+    // NOTE: at this point, variants and tr(anslations) might be uninitialized
   },
 }).$mount("#app");