Commit | Line | Data |
---|---|---|
f5d3e4f5 BA |
1 | new Vue({ |
2 | el: "#variantPage", | |
c794dbb8 | 3 | data: { |
b6487fb9 | 4 | display: "room", //default: main hall |
298c42e6 | 5 | gameid: "undefined", //...yet |
c794dbb8 | 6 | }, |
d449ae46 | 7 | created: function() { |
b6487fb9 | 8 | // TODO: navigation becomes a little more complex |
d449ae46 BA |
9 | const url = window.location.href; |
10 | const hashPos = url.indexOf("#"); | |
11 | if (hashPos >= 0) | |
12 | this.setDisplay(url.substr(hashPos+1)); | |
13 | }, | |
4ecf423b | 14 | methods: { |
e6dcb115 BA |
15 | setDisplay: function(elt) { |
16 | this.display = elt; | |
b6487fb9 | 17 | // Close menu on small screens: |
a5d56686 BA |
18 | let menuToggle = document.getElementById("drawer-control"); |
19 | if (!!menuToggle) | |
20 | menuToggle.checked = false; | |
e6dcb115 | 21 | }, |
4ecf423b | 22 | }, |
f5d3e4f5 | 23 | }); |
81da2786 BA |
24 | |
25 | const continuation = (localStorage.getItem("variant") === variant); | |
26 | if (continuation) //game VS human has priority | |
27 | this.continueGame("human"); | |
b6487fb9 BA |
28 | |
29 | // TODO: | |
30 | // si quand on arrive il y a une continuation "humaine" : display="game" et retour à la partie ! |