Improve style on variant page; TODO: problems, Crazyhouse
[vchess.git] / public / javascripts / variant.js
CommitLineData
f5d3e4f5
BA
1new Vue({
2 el: "#variantPage",
c794dbb8 3 data: {
9a3c9f79 4 display: "game", //default: play!
c794dbb8
BA
5 problem: undefined, //current problem in view
6 },
d449ae46
BA
7 created: function() {
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: {
c794dbb8
BA
14 showProblem: function(problemTxt) {
15 this.problem = JSON.parse(problemTxt);
16 this.display = "game";
17 },
e6dcb115
BA
18 setDisplay: function(elt) {
19 this.display = elt;
20 document.getElementById("drawer-control").checked = false;
21 },
4ecf423b 22 },
f5d3e4f5 23});