summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-12 22:39:39 +0100
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-12 22:39:39 +0100
commit6226c3f330eb7b29440d782966d433c5265ec45e (patch)
treebf7447b22347b89bd8103319f45cc73debe89256 /play.js
parentea0afca358e69a6092ef072994e3cf4ceb3316b9 (diff)
downloadvotes-for-women-6226c3f330eb7b29440d782966d433c5265ec45e.tar.gz
fix click events for touch devices
Diffstat (limited to 'play.js')
-rw-r--r--play.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/play.js b/play.js
index 8b031ee..c09402d 100644
--- a/play.js
+++ b/play.js
@@ -305,11 +305,12 @@ function create(t, p, ...c) {
}
function create_campaigner(color, i) {
- return create("div", {
+ let e = create("div", {
className: `piece ${color}`,
my_campaigner: i,
- onmousedown: on_click_campaigner
})
+ e.addEventListener("click", on_click_campaigner)
+ return e
}
function build_user_interface() {
@@ -322,21 +323,21 @@ function build_user_interface() {
if (r) REGIONS_LAYOUT.push(LAYOUT[r])
}
- ui.congress_box.onmousedown = on_click_congress
+ ui.congress_box.addEventListener("click", on_click_congress)
for (let c = 1; c <= 6; ++c) {
elt = ui.congress[c] = create("div", {
className: "piece congress",
style: `left:${10 + (c-1) * 42}px;top:5px;`,
- onmousedown: on_click_congress
})
+ elt.addEventListener("click", on_click_congress)
}
for (let c = 1; c <= card_count; ++c) {
elt = ui.cards[c] = create("div", {
className: `card card_${c}`,
my_card: c,
- onmousedown: on_click_card
})
+ elt.addEventListener("click", on_click_card)
}
for (let r = 1; r <= region_count; ++r) {