- created: function() {
- //alert("test");
- ajax("/variants", "GET", res => {
- Vue.prototype.$variants = res.variantArray;
- });
- Vue.prototype.$conn = null; //TODO
- const myid = localStorage["myid"] || util.getRandString();
- // NOTE: in this version, we don't say on which page we are, yet
- // ==> we'll say "enter/leave" page XY (in fact juste "enter", seemingly)
- Vue.prototype.$conn = new WebSocket(params.socketUrl + "/?sid=" + myid);
- //TODO: si une partie en cours dans storage, rediriger vers cette partie
- //(à condition que l'URL n'y corresponde pas déjà !)
- // TODO: à l'arrivée sur le site : set peerID (un identifiant unique
- // en tout cas...) si pas trouvé dans localStorage "myid"
- // (l'identifiant de l'utilisateur si connecté)
- },
- // Later, for icons (if using feather):
-// mounted: function() {
-// feather.replace();
-// },
+ created: function() {
+ window.doClick = (elemId) => { document.getElementById(elemId).click() };
+ 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
+ },