if (document.hidden)
notifyMe("move");
vr.playReceivedMove(obj.moves, () => {
- if (vr.getCurrentScore(obj.moves[obj.moves.length-1]) != "*") {
+ if (vr.getCurrentScore(obj.moves) != "*") {
localStorage.removeItem("gid");
setTimeout( () => toggleVisible("gameStopped"), 2000 );
}
case "closerematch":
toggleVisible("newGame");
break;
+ case "filechange":
+ // TODO?: could be more subtle
+ setTimeout(() => location.reload(), 100);
+ break;
}
};
{gid: gid, moves: curMoves, fen: vr.getFen()},
{
retry: true,
- success: () => curMoves = [],
error: () => alert("Move not sent: reload page")
}
);
}
if (ops.res && newTurn != playerColor) {
toggleTurnIndicator(false); //now all moves are sent and animated
- const result = vr.getCurrentScore(move_s);
+ const result = vr.getCurrentScore(curMoves);
+ curMoves = [];
if (result != "*") {
setTimeout(() => {
toggleVisible("gameStopped");