diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-03-22 17:10:45 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-03-22 17:10:45 +0100 |
commit | f58a3fdc03af65cce4ae8381192678f2b3f982af (patch) | |
tree | 8cf257f83a0be997e6a87fd9546e76785b8518ca | |
parent | f2d72a1f60f19a7c5844c3f66d1d0b1a98a3d591 (diff) | |
download | land-and-freedom-f58a3fdc03af65cce4ae8381192678f2b3f982af.tar.gz |
Add medallion tooltips.
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | data.ts | 2 | ||||
-rw-r--r-- | play.css | 5 | ||||
-rw-r--r-- | play.js | 12 |
4 files changed, 16 insertions, 5 deletions
@@ -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, @@ -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, @@ -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; } @@ -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 `<span class="tip" onmouseenter="on_focus_card_tip(${p1})" onmouseleave="on_blur_tip()">${data.cards[p1].title}</span>` } |