- );
- // PlayOnBoard is enough, and more appropriate for Synchrone Chess
- V.PlayOnBoard(this.vr.board, move);
- const position = this.vr.getBaseFen();
- V.UndoOnBoard(this.vr.board, move);
- this.curDiag = getDiagram({
- position: position,
- orientation: V.CanFlip ? this.game.mycolor : "w"
- });
- document.getElementById("modalConfirm").checked = true;
+ };
+ if (["all","byrow"].includes(V.ShowMoves)) {
+ let el = document.querySelector("#buttonsConfirm > .acceptBtn");
+ // We may play several moves in a row: in case of, remove listener:
+ let elClone = el.cloneNode(true);
+ el.parentNode.replaceChild(elClone, el);
+ elClone.addEventListener(
+ "click",
+ () => {
+ document.getElementById("modalConfirm").checked = false;
+ if (!!data.score && data.score != "*")
+ // Set score first
+ this.gameOver(data.score, null, afterSetScore);
+ else afterSetScore();
+ }
+ );
+ // PlayOnBoard is enough, and more appropriate for Synchrone Chess
+ V.PlayOnBoard(this.vr.board, move);
+ const position = this.vr.getBaseFen();
+ V.UndoOnBoard(this.vr.board, move);
+ this.curDiag = getDiagram({
+ position: position,
+ orientation: V.CanFlip ? this.game.mycolor : "w"
+ });
+ document.getElementById("modalConfirm").checked = true;
+ } else {
+ // Incomplete information: just ask confirmation
+ // Hide the board, because otherwise it could be revealed (TODO?)
+ let boardDiv = document.querySelector(".game");
+ boardDiv.style.visibility = "hidden";
+ if (
+ !confirm(
+ this.st.tr["Move played:"] + " " +
+ getFullNotation(move) + "\n" +
+ this.st.tr["Are you sure?"]
+ )
+ ) {
+ this.$refs["basegame"].cancelLastMove();
+ boardDiv.style.visibility = "visible";
+ return;
+ }
+ if (!!data.score && data.score != "*")
+ this.gameOver(data.score, null, afterSetScore);
+ else afterSetScore();
+ }