From c2f610a8864840b400f18bbbae98bf0acef08f62 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:01:52 +0100 Subject: icons in log --- play.js | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'play.js') diff --git a/play.js b/play.js index f4a1aa4..9878400 100644 --- a/play.js +++ b/play.js @@ -405,7 +405,7 @@ function build_user_interface() { for (let i = 0; i < 6; ++i) { elt = ui.opposition_buttons[i] = create("div", { - className: `button button_${(i % 2) + 1}`, + className: `button button_${(i % 2) + 5}`, }) } @@ -521,6 +521,40 @@ function sub_us_state_name(_match, p1, _offset, _string) { return `${n}` } +// TODO blue d4, red d6, white d8 + +const ICONS = { + B0: '', + B1: '', + B2: '', + B3: '', + B4: '', + B5: '', + B6: '', + W0: '', + W1: '', + W2: '', + W3: '', + W4: '', + W5: '', + W6: '', + PR: '', + YR: '', + RR: '', + PC: '', + YC: '', + PYC: '', + RC: '', + BM: '', + CM: '', + GV: '', + RX: '', +} + +function sub_icon(match) { + return ICONS[match] +} + function on_log(text) { // eslint-disable-line no-unused-vars let p = document.createElement("div") @@ -536,6 +570,11 @@ function on_log(text) { // eslint-disable-line no-unused-vars text = text.replace(/R(\d+)/g, sub_region_name) text = text.replace(/S(\d+)/g, sub_us_state_name) + text = text.replace(/\b[PYR]R\b/g, sub_icon) + text = text.replace(/\b[PYR]C|PYC\b/g, sub_icon) + text = text.replace(/\b[BC]M|GV|RX\b/g, sub_icon) + text = text.replace(/\b[BW]\d\b/g, sub_icon) + if (text.match(/^\.h1/)) { text = text.substring(4) p.className = 'h1' -- cgit v1.2.3