diff options
-rw-r--r-- | play.js | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -324,6 +324,13 @@ function is_action(action, arg) { return !!(view.actions && view.actions[action] && set_has(view.actions[action], arg)) } +function create_element(action, id, style) { + let e = document.createElement("div") + e.className = style + register_action(e, action, id) + return e +} + function create_piece(action, id, style) { let e = document.createElement("div") e.className = style @@ -343,12 +350,12 @@ function make_tc_deck(n) { for (let suit = 0; suit <= 3; ++suit) { for (let value = 2; value <= 13; ++value) { let c = (n << 7) | (suit << 4) | value - ui.tc[c] = create_piece("card", c, "card tc deck_" + (n+1) + " " + suit_class[suit] + value) + ui.tc[c] = create_element("card", c, "card tc deck_" + (n+1) + " " + suit_class[suit] + value) } } for (let value = 2; value <= 3; ++value) { let c = (n << 7) | (4 << 4) | value - ui.tc[c] = create_piece("card", c, "card tc deck_" + (n+1) + " R") + ui.tc[c] = create_element("card", c, "card tc deck_" + (n+1) + " R") } } |