summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-12-19 22:07:40 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:38 +0100
commit5a5873974717cc62dc7b2961e6431fd8a658e80b (patch)
tree81eecf9e0005f3ad18ae26678466d7afc45315bc /play.js
parent3b7b4fecbcda982373d5090345118fcf631dfa67 (diff)
downloadnevsky-5a5873974717cc62dc7b2961e6431fd8a658e80b.tar.gz
Card selected and highlight fix.
Diffstat (limited to 'play.js')
-rw-r--r--play.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/play.js b/play.js
index 1732157..0c7add8 100644
--- a/play.js
+++ b/play.js
@@ -1155,15 +1155,19 @@ function update_plan() {
}
function update_cards() {
+ for (let c = 0; c < 42; ++c) {
+ let elt = ui.cards[c]
+ elt.classList.toggle("selected", c === view.what)
+ elt.classList.toggle("action", is_card_action(c))
+ elt.classList.toggle("disabled", false)
+ }
+
if (Array.isArray(view.show_arts_of_war)) {
ui.arts_of_war_dialog.classList.remove("hide")
ui.arts_of_war_list.replaceChildren()
for (let c of view.show_arts_of_war) {
let elt = ui.cards[c]
ui.arts_of_war_list.appendChild(ui.cards[c])
- elt.classList.toggle("selected", c === view.what)
- elt.classList.toggle("action", is_card_action(c))
- elt.classList.remove("disabled")
}
} else if (view.show_arts_of_war === 1) {
ui.arts_of_war_dialog.classList.remove("hide")
@@ -1172,19 +1176,11 @@ function update_cards() {
if (!is_card_in_use(c)) {
let elt = ui.cards[c]
ui.arts_of_war_list.appendChild(elt)
- elt.classList.toggle("selected", c === view.what)
- elt.classList.toggle("action", is_card_action(c))
elt.classList.toggle("disabled", !is_card_action(c))
}
})
} else {
ui.arts_of_war_dialog.classList.add("hide")
- for (let c = 0; c < 42; ++c) {
- let elt = ui.cards[c]
- elt.classList.toggle("selected", false)
- elt.classList.toggle("action", is_card_action(c))
- elt.classList.toggle("disabled", false)
- }
}
ui.events.replaceChildren()