include more detail in the status messages
This commit is contained in:
parent
72c92ae08e
commit
838699994a
|
|
@ -580,6 +580,9 @@ $(function (){
|
|||
}
|
||||
|
||||
function putMeta(extra) {
|
||||
function player(side) {
|
||||
return (side === PS.LIGHT ? 'light' : 'dark');
|
||||
}
|
||||
const gameId = $('#cb_board').data('gameId');
|
||||
const lightName = $('#cb_light_name').val();
|
||||
const darkName = $('#cb_dark_name').val();
|
||||
|
|
@ -588,10 +591,10 @@ $(function (){
|
|||
const lastMove = currentGame.lastMove || {};
|
||||
const lastMeta = lastMove.meta || {};
|
||||
const status =
|
||||
(currentGame.status === PS.PLAYING) ? '' :
|
||||
(currentGame.status === PS.CHECKMATE) ? 'checkmate' :
|
||||
(currentGame.status === PS.RESIGNED) ? 'resigned' :
|
||||
'ended';
|
||||
(currentGame.status === PS.PLAYING) ? `${player(currentGame.player)}'s turn` :
|
||||
(currentGame.status === PS.CHECKMATE) ? `checkmate — ${player(winner)} won` :
|
||||
(currentGame.status === PS.RESIGNED) ? `${player(lastMove.side)} resigned` :
|
||||
'game ended';
|
||||
|
||||
const meta = {
|
||||
lightName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue