|
@@ -32,10 +32,17 @@ function movePiece(from, to, promotion, rcvd) {
|
|
|
tdFrom.addClass('last-origin');
|
|
|
tdTo.addClass('last-target');
|
|
|
|
|
|
- var piece = tdFrom.find('a');
|
|
|
- var moveSnd = $("#moveSnd")[0];
|
|
|
- unselectPiece(piece.parent());
|
|
|
- tdTo.html(piece);
|
|
|
+ var piece = tdFrom.find('a');
|
|
|
+ var moveSnd = $("#moveSnd")[0];
|
|
|
+ unselectPiece(piece.parent());
|
|
|
+
|
|
|
+ if (tdTo.html() !== '') {
|
|
|
+ $('#captured-pieces')
|
|
|
+ .find($chess.turn() === 'b' ? '.b' : '.w')
|
|
|
+ .append('<li>' + tdTo.find('a').html() + '</li>');
|
|
|
+ }
|
|
|
+
|
|
|
+ tdTo.html(piece);
|
|
|
|
|
|
$piece = null;
|
|
|
|