Improve style on variant page; TODO: problems, Crazyhouse
[vchess.git] / public / javascripts / variant.js
index 03dbbdd..f77be32 100644 (file)
@@ -4,13 +4,20 @@ new Vue({
                display: "game", //default: play!
                problem: undefined, //current problem in view
        },
+       created: function() {
+               const url = window.location.href;
+               const hashPos = url.indexOf("#");
+               if (hashPos >= 0)
+                       this.setDisplay(url.substr(hashPos+1));
+       },
        methods: {
-               toggleDisplay: function(elt) {
-                       this.display = elt; //show
-               },
                showProblem: function(problemTxt) {
                        this.problem = JSON.parse(problemTxt);
                        this.display = "game";
                },
+               setDisplay: function(elt) {
+                       this.display = elt;
+                       document.getElementById("drawer-control").checked = false;
+               },
        },
 });