diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-01-20 21:41:28 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:39 +0100 |
commit | f45d7f2f4495703f231cbb337ba17cbea3d8d803 (patch) | |
tree | 44ea7eda0d1bcb7dd8d435ea6c2d8ae9c3c76c91 | |
parent | 5f91c39ed2c0dd350ce09680c364a5450e79855e (diff) | |
download | nevsky-f45d7f2f4495703f231cbb337ba17cbea3d8d803.tar.gz |
Way tooltip highlight.
-rw-r--r-- | play.html | 5 | ||||
-rw-r--r-- | play.js | 19 | ||||
-rw-r--r-- | rules.js | 8 |
3 files changed, 25 insertions, 7 deletions
@@ -32,8 +32,9 @@ header.your_turn { background-color: orange; } #log > div > .i { padding-left: 12px; } #log .card_tip { font-style: italic; } #log .card_tip:hover { text-decoration: underline; } -#log .locale_tip:hover { cursor: pointer; text-decoration: underline; } #log .lord_tip:hover { cursor: pointer; text-decoration: underline; } +#log .locale_tip:hover { cursor: pointer; text-decoration: underline; } +#log .way_tip:hover { cursor: pointer; text-decoration: underline; } .action { cursor: pointer; @@ -765,7 +766,7 @@ body.shift .mustered_vassals { .locale.supply_source { border-color: seagreen; background-color: #2e8b5766; } .locale.supply_source.action { border-color: white; background-color: #2e8b5766; box-shadow: 0 0 0 3px seagreen; } -.locale.tip, .locale_name.tip { +.way.tip, .locale.tip, .locale_name.tip { background-color: #ff08; box-shadow: 0 0 8px #ff08; } @@ -851,6 +851,18 @@ function on_click_locale_tip(loc) { ui.locale[loc].scrollIntoView({ block:"center", inline:"center", behavior:"smooth" }) } +function on_focus_way_tip(way) { + ui.ways[way].classList.add("tip") +} + +function on_blur_way_tip(way) { + ui.ways[way].classList.remove("tip") +} + +function on_click_way(way) { + ui.ways[way].scrollIntoView({ block:"center", inline:"center", behavior:"smooth" }) +} + function on_focus_lord_tip(lord) { } @@ -873,6 +885,12 @@ function sub_lord_name(match, p1) { return `<span class="lord_tip" onmouseenter="on_focus_lord_tip(${x})" onmouseleave="on_blur_lord_tip(${x})" onclick="on_click_lord_tip(${x})">${n}</span>` } +function sub_way_name(match, p1) { + let x = p1 | 0 + let n = data.ways[x].name + return `<span class="way_tip" onmouseenter="on_focus_way_tip(${x})" onmouseleave="on_blur_way_tip(${x})" onclick="on_click_way_tip(${x})">${n}</span>` +} + function on_log(text) { let p = document.createElement("div") @@ -894,6 +912,7 @@ function on_log(text) { text = text.replace(/E(\d+)/g, sub_card_event) text = text.replace(/L(\d+)/g, sub_lord_name) text = text.replace(/%(\d+)/g, sub_locale_name) + text = text.replace(/W(\d+)/g, sub_way_name) if (text.match(/^\.h1/)) { text = text.substring(4) @@ -1,7 +1,5 @@ "use strict" -// TODO: Bridge - kn, sgt, 1x lh, maa, militia, serf, lh, ah - // FIXME: lift_sieges / besieged needs checking! (automatic after disband_lord, manual after move/sail, extra careful manual after battle) // FIXME: remove_legate_if_endangered needs checking! (automatic after disband_lord, manual after move/sail, manual after battle) @@ -4602,7 +4600,7 @@ function march_with_group_2() { spend_march_action(1) if (data.ways[way].name) - log(`Marched via ${data.ways[way].name} to %${to}.`) + log(`Marched via W${way} to %${to}.`) else log(`Marched to %${to}.`) @@ -4860,7 +4858,7 @@ function avoid_battle_2() { let way = game.march.avoid_way if (data.ways[way].name) - log(`Avoided Battle via ${data.ways[way].name} to %${to}.`) + log(`Avoided Battle via W${way} to %${to}.`) else log(`Avoided Battle to %${to}.`) @@ -9103,7 +9101,7 @@ function retreat_2() { let way = game.battle.retreat_way if (data.ways[way].name) - log(`Retreated via ${data.ways[way].name} to %${to}.`) + log(`Retreated via W${way} to %${to}.`) else log(`Retreated to %${to}.`) |