Commit | Line | Data |
---|---|---|
f5d3e4f5 BA |
1 | new Vue({ |
2 | el: "#variantPage", | |
c794dbb8 | 3 | data: { |
a5d56686 | 4 | display: "play", //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); | |
a5d56686 | 16 | this.display = "play"; |
c794dbb8 | 17 | }, |
e6dcb115 BA |
18 | setDisplay: function(elt) { |
19 | this.display = elt; | |
a5d56686 BA |
20 | let menuToggle = document.getElementById("drawer-control"); |
21 | if (!!menuToggle) | |
22 | menuToggle.checked = false; | |
e6dcb115 | 23 | }, |
375ecdd1 BA |
24 | notDark: function() { |
25 | return variant != "Dark"; | |
26 | }, | |
4ecf423b | 27 | }, |
f5d3e4f5 | 28 | }); |