projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve style on variant page; TODO: problems, Crazyhouse
[vchess.git]
/
public
/
javascripts
/
variant.js
diff --git
a/public/javascripts/variant.js
b/public/javascripts/variant.js
index
e9e956c
..
f77be32
100644
(file)
--- a/
public/javascripts/variant.js
+++ b/
public/javascripts/variant.js
@@
-1,25
+1,23
@@
new Vue({
el: "#variantPage",
data: {
new Vue({
el: "#variantPage",
data: {
- display:
getCookie("display-"+variant,""), //default: do not show anything...
+ display:
"game", //default: play!
problem: undefined, //current problem in view
},
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: {
methods: {
- toggleDisplay: function(elt) {
- if (this.display == elt)
- {
- this.display = ""; //hide
- setCookie("display-"+variant, "");
- }
- else
- {
- this.display = elt; //show
- setCookie("display-"+variant, elt);
- }
- },
showProblem: function(problemTxt) {
this.problem = JSON.parse(problemTxt);
this.display = "game";
},
showProblem: function(problemTxt) {
this.problem = JSON.parse(problemTxt);
this.display = "game";
},
+ setDisplay: function(elt) {
+ this.display = elt;
+ document.getElementById("drawer-control").checked = false;
+ },
},
});
},
});