| 1 | new Vue({ |
| 2 | el: "#variantPage", |
| 3 | data: { |
| 4 | display: getCookie("display-"+variant,""), //default: do not show anything... |
| 5 | problem: undefined, //current problem in view |
| 6 | }, |
| 7 | methods: { |
| 8 | toggleDisplay: function(elt) { |
| 9 | if (this.display == elt) |
| 10 | { |
| 11 | this.display = ""; //hide |
| 12 | setCookie("display-"+variant, ""); |
| 13 | } |
| 14 | else |
| 15 | { |
| 16 | this.display = elt; //show |
| 17 | setCookie("display-"+variant, elt); |
| 18 | } |
| 19 | }, |
| 20 | showProblem: function(problemTxt) { |
| 21 | this.problem = JSON.parse(problemTxt); |
| 22 | this.display = "game"; |
| 23 | }, |
| 24 | }, |
| 25 | }); |