From 12cd83d20907475034ce13d1f560d064c8ab6e1c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 21 Dec 2021 16:26:26 +0100 Subject: 300: Add horizontal separators in log and colorize event names. --- ui.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ui.js') diff --git a/ui.js b/ui.js index ec0ee88..d088a26 100644 --- a/ui.js +++ b/ui.js @@ -59,6 +59,7 @@ let ui = { selected_fleets: null, }; +let was_blank = true; create_log_entry = function (text) { let p = document.createElement("div"); text = text.replace(/&/g, "&"); @@ -66,10 +67,23 @@ create_log_entry = function (text) { text = text.replace(/>/g, ">"); text = text.replace(/card (\d+)/g, 'card $1'); + if (text.match(/Greece plays.*:\n/)) + text = text.replace(/:\n(.*)/, ':\n$1'); + if (text.match(/Persia plays.*:\n/)) + text = text.replace(/:\n(.*)/, ':\n$1'); if (text.match(/^Start Campaign /)) { 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) p.innerHTML = text; return p; } -- cgit v1.2.3