diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 20:06:13 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 20:06:13 +0100 |
commit | c5f0a0b71a9f287006868da2e2209b0622164812 (patch) | |
tree | d609e74bfd16b7d0f20b3944bf3cb374c800d9fd /cao-desktop.js | |
parent | fa3f3c775848893bedefbcc5f00746429435d26b (diff) |
display the cards played and allow to select one
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'cao-desktop.js')
-rw-r--r-- | cao-desktop.js | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/cao-desktop.js b/cao-desktop.js index 29fc91c..bb6f4e1 100644 --- a/cao-desktop.js +++ b/cao-desktop.js @@ -8,13 +8,27 @@ $(document).ready(function() { $('#btn_pick_black').show(); }; + cao.on_show_white_card = function(idx, desc) { - /* to change */ - element = $('.card_desc').eq(idx); - element.html(desc); - element.dblclick(this.gen_callback_white_card(i)); + identifier = 'white_card_' + idx; + content = '<li id="' + identifier + '">' + desc + '</li>'; + + $('#white_cards').append(content); + + $('#' + identifier).dblclick(this.gen_callback_white_card(idx)); + }; + + cao.on_show_played_card = function(idx, desc) { + identifier = 'played_card_' + idx; + + content = '<li id="' + identifier + '">' + desc + '</li>'; + + $('#played_cards').append(content); + + $('#' + identifier).dblclick(this.gen_callback_played_card(idx)); }; + cao.on_pick_black_card_ok = function() { $('#btn_collect').show(); $('#btn_pick_black').hide(); @@ -25,14 +39,24 @@ $(document).ready(function() { $('#black_card').html(desc); }; + cao.on_played_white_card_ok = function(idx) { - element = $('.card_desc').eq(idx); - element.empty(); - element.dblclick(null); + identifier = 'white_card_' + idx; + $('#' + identifier).remove(); }; + cao.on_designate_card_ok = function(idx) { + $('#played_cards').empty(); + $('#played_cards').hide(); + $('#black_card').hide(); + $('#btn_collect').hide(); + $('#btn_pick_black').show(); + }; + + cao.on_collect_cards_ok = function() { $('#btn_collect').hide(); + $('#played_cards').show(); }; cao.run(); |