summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/play.js b/play.js
index 2b52dee..c664c89 100644
--- a/play.js
+++ b/play.js
@@ -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")
}
}