chessboardjs
chessboardjs copied to clipboard
Specify spare pieces
Just to confirm: is it not possible to specify spare pieces? It seems you can only pass boolean parameter.
Correct; you cannot specify which pieces show up as spare currently.
On Tuesday, January 12, 2016, Tjorriemorrie [email protected] wrote:
Just to confirm: is it not possible to specify spare pieces? It seems you can only pass boolean parameter.
— Reply to this email directly or view it on GitHub https://github.com/oakmac/chessboardjs/issues/115.
I would like to add that feature; any advice on where to begin or the section of code is?
In chessboard-0.3.0.js look under the heading Markup Building for the function buildSparePieces.
function buildSparePieces(color) {
var pieces = ['wK', 'wQ', 'wR', 'wB', 'wN', 'wP'];
if (color === 'black') {
pieces = ['bK', 'bQ', 'bR', 'bB', 'bN', 'bP'];
} ...
Delete whichever pieces you don't want. For example, remove 'wR', to remove the white rook.