prevent notification for incomplete moves

This commit is contained in:
Jesse D. McDonald 2020-03-13 11:18:16 -05:00
parent f4340312fd
commit 223fd6490a
1 changed files with 6 additions and 4 deletions

View File

@ -573,12 +573,14 @@ function switchGameId(newId){
const board = JSON.parse(d['board']); const board = JSON.parse(d['board']);
const cb_board = $('#cb_board').first(); const cb_board = $('#cb_board').first();
if ($('#cb_notify')[0].checked && cb_board.data('skip_notify') !== d['board']) { if ($('#cb_notify')[0].checked && cb_board.data('skip_notify') !== d['board']) {
if (!board['phantom']) {
if (board['move'] && board['move']['took'] === 'k') { if (board['move'] && board['move']['took'] === 'k') {
notify((board['move']['side'][0] === 'd' ? 'Dark' : 'Light') + ' player won!'); notify((board['move']['side'][0] === 'd' ? 'Dark' : 'Light') + ' player won!');
} else { } else {
notify((board['player'][0] === 'd' ? 'Dark' : 'Light') + ' player\'s turn'); 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); $('#cb_board').data('board', board);
renderBoard(board); renderBoard(board);