- toggleDisplay: function(elt) {
- if (this.display == elt)
- this.display = ""; //hide
- else
- this.display = elt; //show
+ setDisplay: function() {
+
+//TODO: prevent set display if there is a running game
+
+ if (!location.hash)
+ location.hash = "#room"; //default
+ this.display = location.hash.substr(1);
+ // 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();
+ },
+ undo: function(move) {
+ this.vr.undo(move);
+ if (this.sound == 2)
+ new Audio("/sounds/undo.mp3").play().catch(err => {});
+ this.incheck = this.vr.getCheckSquares(this.vr.turn);