Almost finished: just translations TODO
[vchess.git] / public / javascripts / variant.js
1 new Vue({
2 el: "#variantPage",
3 data: {
4 display: "play", //default: play!
5 problem: undefined, //current problem in view
6 },
7 created: function() {
8 const url = window.location.href;
9 const hashPos = url.indexOf("#");
10 console.log(hashPos + " " + url);
11 if (hashPos >= 0)
12 this.setDisplay(url.substr(hashPos+1));
13 },
14 methods: {
15 showProblem: function(problemTxt) {
16 this.problem = JSON.parse(problemTxt);
17 this.display = "play";
18 },
19 setDisplay: function(elt) {
20 this.display = elt;
21 let menuToggle = document.getElementById("drawer-control");
22 if (!!menuToggle)
23 menuToggle.checked = false;
24 },
25 },
26 });