diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-05-18 11:34:43 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-05-18 11:34:43 +0200 |
commit | e05715058fe2cbc3cb5d95dd9bd867f686e486c8 (patch) | |
tree | 3baf52a98997048fb409655bc934598afe214fd3 | |
parent | 5c6876ac876a235f8684431e5e3b47464172a303 (diff) | |
download | plantagenet-e05715058fe2cbc3cb5d95dd9bd867f686e486c8.tar.gz |
verbose locale tooltips
-rw-r--r-- | play.js | 30 |
1 files changed, 27 insertions, 3 deletions
@@ -535,7 +535,7 @@ function build_card(c, name) { e.style.width = aw + "px" e.style.height = ah + "px" register_action(e, "locale", ix) - register_tooltip(e, get_locale_tip(ix)) + register_tooltip(e, on_focus_locale) document.getElementById("locales").appendChild(e) // London for York @@ -1616,8 +1616,32 @@ function on_blur() { update_current_card_display() } -function get_locale_tip(id) { - return data.locales[id].name +function on_focus_locale(evt) { + let id = evt.target.my_id + let info = data.locales[id] + let tip = info.name + + if (info.type === "fortress") + tip += " - Fortress" + else if (info.type === "city") + tip += " - City" + else if (info.type === "town") + tip += " - Town" + + if (set_has(data.all_ports, id)) + tip += " - Port" + + if (set_has(view.pieces.depleted, id)) + tip += " - Depleted" + if (set_has(view.pieces.exhausted, id)) + tip += " - Exhausted" + + if (set_has(view.pieces.favourl, id)) + tip += " - Lancastrian" + if (set_has(view.pieces.favoury, id)) + tip += " - Yorkist" + + on_focus(tip) } function on_focus_cylinder(evt) { |