summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/play.js b/play.js
index b5983c4..55c5433 100644
--- a/play.js
+++ b/play.js
@@ -59,7 +59,6 @@ let ui = {
selected_fleets: null,
};
-let was_blank = true;
function on_log(text) {
let p = document.createElement("div");
text = text.replace(/&/g, "&");
@@ -67,23 +66,18 @@ function on_log(text) {
text = text.replace(/>/g, ">");
text = text.replace(/card (\d+)/g,
'<span class="tip" onmouseenter="on_focus_card_tip($1)" onmouseleave="on_blur_card_tip()">card $1</span>');
- if (text.match(/Greece plays.*:\n/))
+ if (text.match(/Greece played.*:\n/))
text = text.replace(/:\n(.*)/, ':\n<span class="G">$1</span>');
- if (text.match(/Persia plays.*:\n/))
+ if (text.match(/Persia played.*:\n/))
text = text.replace(/:\n(.*)/, ':\n<span class="P">$1</span>');
if (text.match(/^Start Campaign /)) {
- p.className = 'st';
+ p.className = "st";
text = text.substring(6);
}
- if (text.match(/Supply Phase$/))
- p.className = 'hr';
- if (text.match(/(Greece|Persia|Nobody) scores/))
- p.className = 'hr';
- if (text.match(/Greek Preparation Phase$/))
- p.className = 'hr';
- if (was_blank && text.match(/^(Greece|Persia) (plays|passes)/))
- p.className = 'hr';
- was_blank = (text.length === 0)
+ if (text.match(/^.hr$/)) {
+ p.className = "hr";
+ text = "";
+ }
p.innerHTML = text;
return p;
}