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. --- data.js | 2 +- data.ts | 2 +- play.css | 5 ++--- play.js | 12 ++++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/data.js b/data.js index 5adf1d8..eedacff 100644 --- a/data.js +++ b/data.js @@ -1772,7 +1772,7 @@ const data = { { id: 2, name: 'Momentum', - tooltip: 'Play another card.' + tooltip: 'Play another card after the current card.' }, { id: STRATEGY_MEDALLION_ID, diff --git a/data.ts b/data.ts index a06cf10..b9cb79a 100644 --- a/data.ts +++ b/data.ts @@ -1845,7 +1845,7 @@ const data: StaticData = { { id: 2, name: 'Momentum', - tooltip: 'Play another card.' + tooltip: 'Play another card after the current card.' }, { id: STRATEGY_MEDALLION_ID, diff --git a/play.css b/play.css index 843c4d6..e2a0109 100644 --- a/play.css +++ b/play.css @@ -226,9 +226,8 @@ body header.fascist.your_turn { background-color: hsl(30, 35%, 65%); } background-size: 100% 100%; } -.token:not(.action) { - pointer-events: none; -} +.token.blank:not(.action) { pointer-events: none; } +.token.standee:not(.action) { pointer-events: none; } /* :r! node tools/gencolor.js */ .token.white { background-color: #bbbbbb; border-color: #d6d6d6 #737373 #737373 #d6d6d6; box-shadow: 0 0 0 1px #323232, 0px 1px 4px #0008; } 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