- toggleDisplay: function(elt) {
- if (this.display == elt)
- {
- this.display = ""; //hide
- setCookie("display-"+variant, "");
- }
- else
- {
- this.display = elt; //show
- setCookie("display-"+variant, elt);
- }
+ setDisplay: function() {
+
+//TODO: prevent set display if there is a running game
+
+ const page = (location.hash || "#room").substr(1);
+ this.display = page;
+ // Close menu on small screens:
+ let menuToggle = document.getElementById("drawer-control");
+ if (!!menuToggle)
+ menuToggle.checked = false;
+ },
+
+ // TEMPORARY: DEBUG (duplicate code)
+ play: function(move) {
+ // Not programmatic, or animation is over
+ if (!move.notation)
+ move.notation = this.vr.getNotation(move);
+ this.vr.play(move);
+ if (!move.fen)
+ move.fen = this.vr.getFen();
+ if (this.sound == 2)
+ new Audio("/sounds/move.mp3").play().catch(err => {});
+ // Is opponent in check?
+ this.incheck = this.vr.getCheckSquares(this.vr.turn);
+ const score = this.vr.getCurrentScore();