game-client.js
function getMyPieces(player) {
    for (var i in player.pieces) {
        var piece = player.pieces[i];
        $(PIECES).append('<div class="piece" style="color:'+
                         pastels[piece.color]+'">'+ushapes[piece.shape]+'</div>');
        $(PIECECLS+":last-child").data("piece", piece);
        $(PIECES).append("<div style='float: left; margin: 3px'></div>");
    }

    function setDimensions() {
        $(PIECECLS).width($(GRIDCLS).width());
        $(PIECECLS).height($(GRIDCLS).height());
        var fontsize = $(GRIDCLS).css("font-size");
        $(PIECECLS).css("font-size", fontsize);
        $(PIECECLS).css("line-height", fontsize);
    }
    /* Style switching is flaky here, we're depending on the width that was set
     * in getBoard() and maybe that happens too fast sometimes. So we add a
     * setTimeout to try setting dimensions again in a short while.
     */
    setDimensions();
    setTimeout(setDimensions, 250);

    if (player.has_turn)
        $(PIECECLS).draggable({
            containment: "#board",
            snap: ".snapgrid"
        });
}
function getMyPieces(player) {
    for (var i in player.pieces) {
        var piece = player.pieces[i];
        $(PIECES).append('<div class="piece" style="color:'+
                         pastels[piece.color]+'">'+ushapes[piece.shape]+'</div>');
        $(PIECECLS+":last-child").data("piece", piece);
        $(PIECES).append("<div style='float: left; margin: 3px'></div>");
    }

    function setDimensions() {
        $(PIECECLS).width($(GRIDCLS).width());
        $(PIECECLS).height($(GRIDCLS).height());
        var fontsize = $(GRIDCLS).css("font-size");
        $(PIECECLS).css("font-size", fontsize);
        $(PIECECLS).css("line-height", fontsize);
    }
    /* Style switching is flaky here, we're depending on the width that was set
     * in getBoard() and maybe that happens too fast sometimes. So we add a
     * setTimeout to try setting dimensions again in a short while.
     */
    setDimensions();
    setTimeout(setDimensions, 250);

    if (player.has_turn)
        $(PIECECLS).draggable({
            containment: "#board",
            snap: ".snapgrid"
        });
}
function getMyPieces ( player ) { for ( var i in player . pieces ) { var piece = player . pieces [ i ] ; $ ( PIECES ) . append ( '<div class="piece" style="color:' + pastels [ piece . color ] + '">' + ushapes [ piece . shape ] + '</div>' ) ; $ ( PIECECLS + ":last-child" ) . data ( "piece" , piece ) ; $ ( PIECES ) . append ( "<div style='float: left; margin: 3px'></div>" ) ; } function setDimensions ( ) { $ ( PIECECLS ) . width ( $ ( GRIDCLS ) . width ( ) ) ; $ ( PIECECLS ) . height ( $ ( GRIDCLS ) . height ( ) ) ; var fontsize = $ ( GRIDCLS ) . css ( "font-size" ) ; $ ( PIECECLS ) . css ( "font-size" , fontsize ) ; $ ( PIECECLS ) . css ( "line-height" , fontsize ) ; } /* Style switching is flaky here, we're depending on the width that was set
     * in getBoard() and maybe that happens too fast sometimes. So we add a
     * setTimeout to try setting dimensions again in a short while.
     */ setDimensions ( ) ; setTimeout ( setDimensions , 250 ) ; if ( player . has_turn ) $ ( PIECECLS ) . draggable ( { containment : "#board" , snap : ".snapgrid" } ) ; }
Add player's pieces to his sideboard and make active if it's his turn.
@param {obj} player
Add player s pieces to his sideboard and make active if it s his turn .