diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-12-21 16:26:26 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:42:59 +0100 |
commit | 12cd83d20907475034ce13d1f560d064c8ab6e1c (patch) | |
tree | 44ef433a68e705f07c63b4697777d1c7eba7a69e /ui.js | |
parent | 9aae82b288e41cef6e38d65ffb3a1403d6d06369 (diff) | |
download | 300-earth-and-water-12cd83d20907475034ce13d1f560d064c8ab6e1c.tar.gz |
300: Add horizontal separators in log and colorize event names.
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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, '<span class="tip" onmouseenter="on_focus_card_tip($1)" onmouseleave="on_blur_card_tip()">card $1</span>'); + if (text.match(/Greece plays.*:\n/)) + text = text.replace(/:\n(.*)/, ':\n<span class="G">$1</span>'); + if (text.match(/Persia plays.*:\n/)) + text = text.replace(/:\n(.*)/, ':\n<span class="P">$1</span>'); 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; } |