From f58a3fdc03af65cce4ae8381192678f2b3f982af Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 22 Mar 2025 17:10:45 +0100 Subject: Add medallion tooltips. --- play.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'play.js') diff --git a/play.js b/play.js index 6592ac9..4456972 100644 --- a/play.js +++ b/play.js @@ -7,6 +7,7 @@ const ui = { header: document.querySelector("header"), + status: document.getElementById("status"), hand_panel: document.getElementById("hand_panel"), map_container: document.getElementById("pieces"), @@ -332,6 +333,8 @@ function on_init() { for (i = 0; i < 9; ++i) { e = (ui.medallions[i] = document.createElement("div")) e.className = "pink token medallion medallion_" + i + e.onmouseenter = on_focus_medallion + e.onmouseleave = on_blur_medallion register_action(e, "medallion", i) register_animation(e) } @@ -601,6 +604,15 @@ function on_blur_tip(x) { ui.tooltip.className = "hide" } +function on_focus_medallion(evt) { + let info = data.medallions[evt.target.my_id] + ui.status.textContent = info.name + ": " + info.tooltip +} + +function on_blur_medallion() { + ui.status.textContent = "" +} + function sub_card(_match, p1) { return `${data.cards[p1].title}` } -- cgit v1.2.3