Draft code reorganisation (+ fix Alice rules + stateless VariantRules object)
[vchess.git] / public / javascripts / variant.js
CommitLineData
f5d3e4f5
BA
1new Vue({
2 el: "#variantPage",
c794dbb8 3 data: {
b6487fb9 4 display: "room", //default: main hall
c794dbb8 5 },
d449ae46 6 created: function() {
b6487fb9 7 // TODO: navigation becomes a little more complex
d449ae46
BA
8 const url = window.location.href;
9 const hashPos = url.indexOf("#");
10 if (hashPos >= 0)
11 this.setDisplay(url.substr(hashPos+1));
12 },
4ecf423b 13 methods: {
e6dcb115
BA
14 setDisplay: function(elt) {
15 this.display = elt;
b6487fb9 16 // Close menu on small screens:
a5d56686
BA
17 let menuToggle = document.getElementById("drawer-control");
18 if (!!menuToggle)
19 menuToggle.checked = false;
e6dcb115 20 },
4ecf423b 21 },
f5d3e4f5 22});
b6487fb9
BA
23
24// TODO:
25// si quand on arrive il y a une continuation "humaine" : display="game" et retour à la partie !