summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-14 15:32:30 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-24 21:06:18 +0200
commit4e5227a05928528f1e812f2ff901f392153726c9 (patch)
tree5477e2116e2dec986431b0217d20703f4abb361b /play.js
parent85fce222cddf1f6ac6ef82cdd8031e25e52a959f (diff)
downloadred-flag-over-paris-4e5227a05928528f1e812f2ff901f392153726c9.tar.gz
Tweak panel layout.
Diffstat (limited to 'play.js')
-rw-r--r--play.js38
1 files changed, 16 insertions, 22 deletions
diff --git a/play.js b/play.js
index 4dcf283..fe3d55c 100644
--- a/play.js
+++ b/play.js
@@ -353,7 +353,6 @@ function sub_space_name(match, p1, offset, string) {
if (c <= 11)
return '<span class="paris">' + n + "</span>"
}
-
if (true) {
if (c <= 2)
return '<img class="s" src="space_institutional.svg">' + n
@@ -416,12 +415,7 @@ function on_log(text) {
if (text.match(/^\.h2/)) {
text = text.substring(4)
- if (text === 'Commune')
- p.className = 'h2 commune'
- else if (text === 'Versailles')
- p.className = 'h2 versailles'
- else
- p.className = 'h2'
+ p.className = 'h2'
}
if (text.match(/^\.h3/)) {
@@ -429,16 +423,11 @@ function on_log(text) {
p.className = 'h3'
}
- if (text.match(/^.hr$/)) {
- p.className = "hr";
- text = "";
- }
-
p.innerHTML = text
return p
}
-function on_update_objective(parent, objective) {
+function on_update_objective(panel, parent, objective) {
if (typeof objective === "object") {
for (let c of objective)
parent.appendChild(ui.cards[c])
@@ -446,7 +435,6 @@ function on_update_objective(parent, objective) {
parent.appendChild(ui.objective_back[0])
} else if (objective === 2) {
parent.appendChild(ui.objective_back[0])
- parent.appendChild(ui.objective_back[1])
} else if (objective > 2) {
parent.appendChild(ui.cards[objective])
}
@@ -477,18 +465,20 @@ function on_update() {
document.querySelector("body").classList.toggle("censorship", view.censorship === 1)
document.getElementById("hand").replaceChildren()
+ document.getElementById("final").replaceChildren()
document.getElementById("discard").replaceChildren()
document.getElementById("set_aside").replaceChildren()
- document.getElementById("commune_cards").replaceChildren()
- document.getElementById("versailles_cards").replaceChildren()
+ document.getElementById("red_objective").replaceChildren()
+ document.getElementById("blue_objective").replaceChildren()
+ if (view.blue_final)
+ document.getElementById("final").appendChild(ui.cards[view.blue_final])
if (view.red_final)
- document.getElementById("commune_cards").appendChild(ui.cards[view.red_final])
- on_update_objective(document.getElementById("commune_cards"), view.red_objective)
+ document.getElementById("final").appendChild(ui.cards[view.red_final])
- if (view.blue_final)
- document.getElementById("versailles_cards").appendChild(ui.cards[view.blue_final])
- on_update_objective(document.getElementById("versailles_cards"), view.blue_objective)
+ on_update_objective(document.getElementById("blue_objective_panel"), document.getElementById("blue_objective"), view.blue_objective)
+
+ on_update_objective(document.getElementById("red_objective_panel"), document.getElementById("red_objective"), view.red_objective)
if (view.discard)
document.getElementById("discard").appendChild(ui.cards[view.discard])
@@ -496,9 +486,13 @@ function on_update() {
if (view.hand)
for (let c of view.hand)
document.getElementById("hand").appendChild(ui.cards[c])
- if (view.set_aside)
+ if (view.set_aside) {
+ document.getElementById("set_aside_panel").classList.remove("hide")
for (let c of view.set_aside)
document.getElementById("set_aside").appendChild(ui.cards[c])
+ } else {
+ document.getElementById("set_aside_panel").classList.add("hide")
+ }
for (let i = 0; i < space_names.length; ++i)
layout[i] = []