X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.coffee;h=774e29e197f4904742753d02a24a1ac10b0dbc35;hb=bff997aff6d7220a8183421bdff64c9a1ef352c3;hp=a87cb5404d6b074c0bb8dcb3cb20d9f1dddb3395;hpb=f46ce45eaf3db64e5d7bd9ea2c19ed3d4431c35a;p=peach-cgt.git diff --git a/client.coffee b/client.coffee index a87cb54..774e29e 100644 --- a/client.coffee +++ b/client.coffee @@ -24,20 +24,34 @@ unless Array::shuffle? @[top] = tmp return +new_button = (text) -> $ $ "
#{text}
" + add_card = (text, x, y) -> - card = $ $ "
#{text}
 
" + card = $ $ "
#{text}
" + button_box = $ $ '
' + flip_button = new_button "flip over" + mark_button = new_button "mark" + flip_button.bind 'click', -> + card.toggleClass 'flipped' + # FIXME tell server + mark_button.bind 'click', -> + card.toggleClass 'marked' + # FIXME tell server + button_box.append flip_button + button_box.append mark_button + card.append button_box $table.append card - card.draggable() + card.draggable stack: '.card' card.bind 'dragstop', (event, ui) -> p = card.position() - card.children().html("(#{p.left}, #{p.top})") - # FIXME tell server - + # FIXME tell server (p.left, p.top) + init = -> if state.auto_shuffle state.my_cards.shuffle() state.your_cards.shuffle() # FIXME have the server or other player do this state.auto_shuffle = false + # FIXME tell server left = 15 top = 450 for card in state.my_cards