From bde8eee5ad4974ec1d9a2f83dc8bbbf9cfb336f2 Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Fri, 13 Mar 2020 16:32:52 -0500 Subject: [PATCH] fix for notifying after undo/redo --- js/chess.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/chess.js b/js/chess.js index b23959e..fd06376 100644 --- a/js/chess.js +++ b/js/chess.js @@ -573,15 +573,16 @@ function switchGameId(newId){ const board = JSON.parse(d['board']); const cb_board = $('#cb_board').first(); if ($('#cb_notify')[0].checked && cb_board.data('skip_notify') !== d['board']) { - if (!board['phantom']) { + /* ignore partial moves and undo/redo */ + if (!board['phantom'] && !board['subsequent']) { if (board['move'] && board['move']['took'] === 'k') { notify((board['move']['side'][0] === 'd' ? 'Dark' : 'Light') + ' player won!'); } else { notify((board['player'][0] === 'd' ? 'Dark' : 'Light') + ' player\'s turn'); } + $('#cb_board').data('skip_notify', d['board']); } } - $('#cb_board').data('skip_notify', d['board']); $('#cb_board').data('board', board); renderBoard(board); }