- delete localStorage["variant"];
- delete localStorage["myid"];
- delete localStorage["mycolor"];
- delete localStorage["oppid"];
- delete localStorage["fenStart"];
- delete localStorage["fen"];
- delete localStorage["moves"];
- },
- clickGameSeek: function() {
+ if (this.mode == "human")
+ {
+ delete localStorage["myid"];
+ delete localStorage["oppid"];
+ delete localStorage["gameId"];
+ }
+ const prefix = this.getStoragePrefix(this.mode);
+ delete localStorage[prefix+"variant"];
+ delete localStorage[prefix+"mycolor"];
+ delete localStorage[prefix+"fenStart"];
+ delete localStorage[prefix+"moves"];
+ delete localStorage[prefix+"fen"];
+ delete localStorage[prefix+"score"];
+ },
+ // HACK because mini-css tooltips are persistent after click...
+ // NOTE: seems to work only in chrome/chromium. TODO...
+ getRidOfTooltip: function(elt) {
+ elt.style.visibility = "hidden";
+ setTimeout(() => { elt.style.visibility="visible"; }, 100);
+ },
+ startChat: function(e) {
+ this.getRidOfTooltip(e.currentTarget);
+ document.getElementById("modal-chat").checked = true;
+ },
+ clearCurrentGame: function(e) {
+ this.getRidOfTooltip(e.currentTarget);
+ this.clearStorage();
+ location.reload(); //to see clearing effects
+ },
+ showSettings: function(e) {
+ this.getRidOfTooltip(e.currentTarget);
+ document.getElementById("modal-settings").checked = true;
+ },
+ toggleHints: function() {
+ this.hints = !this.hints;
+ localStorage["hints"] = (this.hints ? "1" : "0");
+ },
+ setBoardColor: function(e) {
+ this.bcolor = e.target.options[e.target.selectedIndex].value;
+ localStorage["bcolor"] = this.bcolor;
+ },
+ setSound: function(e) {
+ this.sound = parseInt(e.target.options[e.target.selectedIndex].value);
+ localStorage["sound"] = this.sound;
+ },
+ clickGameSeek: function(e) {
+ this.getRidOfTooltip(e.currentTarget);