X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fvariant.js;h=eac1ec0920790e3d719a9d76c693086ad3f6eb4c;hp=f77be32992db56f0f3c9c020273c9c9660cb1398;hb=8d7e2786f5a67a1b9a77c742d7951e0efbe8747d;hpb=d449ae46d69980f18c96dbd5a87135d257dcb19d diff --git a/public/javascripts/variant.js b/public/javascripts/variant.js index f77be329..eac1ec09 100644 --- a/public/javascripts/variant.js +++ b/public/javascripts/variant.js @@ -1,23 +1,30 @@ new Vue({ el: "#variantPage", data: { - display: "game", //default: play! - problem: undefined, //current problem in view + display: "room", //default: main hall + gameid: "undefined", //...yet }, created: function() { + // TODO: navigation becomes a little more complex const url = window.location.href; const hashPos = url.indexOf("#"); if (hashPos >= 0) this.setDisplay(url.substr(hashPos+1)); }, methods: { - showProblem: function(problemTxt) { - this.problem = JSON.parse(problemTxt); - this.display = "game"; - }, setDisplay: function(elt) { this.display = elt; - document.getElementById("drawer-control").checked = false; + // Close menu on small screens: + let menuToggle = document.getElementById("drawer-control"); + if (!!menuToggle) + menuToggle.checked = false; }, }, }); + +//const continuation = (localStorage.getItem("variant") === variant.name); +// if (continuation) //game VS human has priority +// this.continueGame("human"); + +// TODO: +// si quand on arrive il y a une continuation "humaine" : display="game" et retour à la partie !