Fix king tracking in Fusion variant
[vchess.git] / client / src / main.js
1 import Vue from "vue";
2 import App from "./App.vue";
3 import router from "./router";
4 import { store } from "./store";
5
6 Vue.config.productionTip = false;
7
8 new Vue({
9 router,
10 render: function(h) {
11 return h(App);
12 },
13 created: function() {
14 // Several interactions on clicks on elements:
15 window.doClick = elemId => {
16 document.getElementById(elemId).click();
17 };
18 // Esc key can close some modals:
19 document.addEventListener("keydown", e => {
20 if (e.code === "Escape") {
21 let modalBoxes = document.querySelectorAll("[id^='modal']");
22 modalBoxes.forEach(m => {
23 if (
24 m.checked &&
25 !["modalAccept", "modalConfirm", "modalChat", "modalPeople"]
26 .includes(m.id)
27 ) {
28 m.checked = false;
29 }
30 });
31 }
32 });
33 store.initialize();
34 }
35 }).$mount("#app");