@[top] = tmp
return
+new_button = (text) -> $ $ "<div class=\"button\">#{text}</div>"
+
add_card = (text, x, y) ->
- card = $ $ "<div class=\"card\" style=\"left: #{x}px; top: #{y}px\">#{text}<br><span> </span></div>"
+ card = $ $ "<div class=\"card\" style=\"left: #{x}px; top: #{y}px\"><span class=\"cardtext\">#{text}</span></div>"
+ button_box = $ $ '<div/>'
+ 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 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