X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fmain.js;h=f2e38f1f75b66e1b2e1fec1adc2ff160a57c0760;hb=afde76668963c4d0d96002fcae2ebabb9acf81e4;hp=6e22936267497ca1ea76652a31532d33064b8f0c;hpb=63ca2b89cfe577efd168c6b2e26750cb01b66d64;p=vchess.git diff --git a/client/src/main.js b/client/src/main.js index 6e229362..f2e38f1f 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -11,20 +11,24 @@ new Vue({ return h(App); }, created: function() { - window.doClick = (elemId) => { document.getElementById(elemId).click() }; - document.addEventListener("keydown", (e) => { - if (e.code === "Escape") - { + // Several interactions on clicks on elements: + window.doClick = elemId => { + document.getElementById(elemId).click(); + }; + // Esc key can close modals: + document.addEventListener("keydown", e => { + if (e.code === "Escape") { let modalBoxes = document.querySelectorAll("[id^='modal']"); modalBoxes.forEach(m => { - if (m.checked) + if ( + m.checked && + !["modalAccept","modalConfirm"].includes(m.id) + ) { m.checked = false; + } }); } }); - // TODO: why is this wrong? - //store.initialize(this.$route.path); - store.initialize(window.location.href.split("#")[1]); - // NOTE: at this point, variants and tr(anslations) might be uninitialized - }, + store.initialize(); + } }).$mount("#app");