fix for notifying after undo/redo

This commit is contained in:
Jesse D. McDonald 2020-03-13 16:32:52 -05:00
parent 223fd6490a
commit bde8eee5ad
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}