diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-11-24 11:19:30 +0100 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-11-24 11:19:30 +0100 |
commit | d4ede91cf06b0d544afea4b5f3aa1c2040cc803d (patch) | |
tree | 1ef2754cdf3ef8f13ffce22f615a30eb0ce4f03e /play.js | |
parent | 015eb625c467ccf68666807072e562a668479e47 (diff) | |
download | votes-for-women-d4ede91cf06b0d544afea4b5f3aa1c2040cc803d.tar.gz |
show persistent cards as stack
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -655,18 +655,16 @@ function on_update() { // eslint-disable-line no-unused-vars for (let c of view.out_of_play) document.getElementById("out_of_play").appendChild(ui.cards[c]) - // TODO Replace with stacked cards for (let id of ['persistent_turn', 'persistent_game', 'persistent_ballot']) { - document.getElementById(id).replaceChildren() - for (let c of view[id] || []) { - let elt = create("div", { - className: `persistent_card ${CARDS[c].type}`, - innerHTML: sub_card_name(null, c), - my_card: c - }) - elt.addEventListener("click", on_click_card) - elt.classList.toggle("action", is_card_enabled(c)) - document.getElementById(id).appendChild(elt) + const container = document.getElementById(id) + container.replaceChildren() + const stack = view[id] || [] + for (let i = 0; i < stack.length; ++i) { + const c = stack[i] + const elt = ui.cards[c] + elt.style.top = -85 * i + "px" + elt.style.zIndex = i + 10 + container.appendChild(elt) } } |