From e05715058fe2cbc3cb5d95dd9bd867f686e486c8 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 18 May 2024 11:34:43 +0200 Subject: verbose locale tooltips --- play.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/play.js b/play.js index dec6038..26dffec 100644 --- a/play.js +++ b/play.js @@ -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) { -- cgit v1.2.3