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