| 1 | new Vue({ |
| 2 | el: "#variantPage", |
| 3 | data: { |
| 4 | display: "game", //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 | if (hashPos >= 0) |
| 11 | this.setDisplay(url.substr(hashPos+1)); |
| 12 | }, |
| 13 | methods: { |
| 14 | showProblem: function(problemTxt) { |
| 15 | this.problem = JSON.parse(problemTxt); |
| 16 | this.display = "game"; |
| 17 | }, |
| 18 | setDisplay: function(elt) { |
| 19 | this.display = elt; |
| 20 | document.getElementById("drawer-control").checked = false; |
| 21 | }, |
| 22 | }, |
| 23 | }); |