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 putMeta(extra) {
|
||||||
|
function player(side) {
|
||||||
|
return (side === PS.LIGHT ? 'light' : 'dark');
|
||||||
|
}
|
||||||
const gameId = $('#cb_board').data('gameId');
|
const gameId = $('#cb_board').data('gameId');
|
||||||
const lightName = $('#cb_light_name').val();
|
const lightName = $('#cb_light_name').val();
|
||||||
const darkName = $('#cb_dark_name').val();
|
const darkName = $('#cb_dark_name').val();
|
||||||
|
|
@ -588,10 +591,10 @@ $(function (){
|
||||||
const lastMove = currentGame.lastMove || {};
|
const lastMove = currentGame.lastMove || {};
|
||||||
const lastMeta = lastMove.meta || {};
|
const lastMeta = lastMove.meta || {};
|
||||||
const status =
|
const status =
|
||||||
(currentGame.status === PS.PLAYING) ? '' :
|
(currentGame.status === PS.PLAYING) ? `${player(currentGame.player)}'s turn` :
|
||||||
(currentGame.status === PS.CHECKMATE) ? 'checkmate' :
|
(currentGame.status === PS.CHECKMATE) ? `checkmate — ${player(winner)} won` :
|
||||||
(currentGame.status === PS.RESIGNED) ? 'resigned' :
|
(currentGame.status === PS.RESIGNED) ? `${player(lastMove.side)} resigned` :
|
||||||
'ended';
|
'game ended';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
lightName,
|
lightName,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue