diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-05-09 01:30:03 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:12:42 +0100 |
commit | bc10c7f7766ee322ab34b76bd557f5c5fed390d2 (patch) | |
tree | 4f5bf44825e172bdbbd4e35934b692d61266c9ef /play.js | |
parent | 6017ae2b49ae0b32adc614c121fe488e3a4bfd59 (diff) | |
download | shores-of-tripoli-bc10c7f7766ee322ab34b76bd557f5c5fed390d2.tar.gz |
Use card numbers in raw log format.
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -124,6 +124,15 @@ function sub_log_entry_tip(match, p1, offset, string) { return match; } +function sub_log_entry_tip2(match, p1, offset, string) { + let card_number = p1 | 0; + if (card_number < 28) + return `\n<span class="us_tip" onmouseenter="on_focus_card_tip('us_card_${card_number}')" onmouseleave="on_blur_card_tip()">${US_CARD_NAMES[card_number-1]}</span>`; + else + return `\n<span class="tr_tip" onmouseenter="on_focus_card_tip('tr_card_${card_number-27}')" onmouseleave="on_blur_card_tip()">${TR_CARD_NAMES[card_number-28]}</span>`; + return match; +} + let last_log_who = 'st'; function on_log(text) { let p = document.createElement("div"); @@ -131,12 +140,19 @@ function on_log(text) { text = text.replace(/</g, "<"); text = text.replace(/>/g, ">"); text = text.replace(/\u201c(.*)\u201d/g, sub_log_entry_tip); + text = text.replace(/#(\d+)/g, sub_log_entry_tip2); if (text.match(/^Start of \d+/)) { text = text.substring(9, text.length-1); p.className = 'year'; } else if (text.match(/^Start of /)) { text = text.substring(9, text.length-1); p.className = 'season'; + } else if (text.match(/^.year \d+/)) { + text = text.substring(6); + p.className = 'year'; + } else if (text.match(/^.season /)) { + text = text.substring(8); + p.className = 'season'; } else if (text.match(/^Pirate raid from/)) { p.className = 'raid'; } else if (text.match(/^(Naval|Land) (battle|bombardment) in/)) { |