From 7dba9f1fc1823f017168948f817a9bc76971b5a4 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Tue, 10 Oct 2023 07:34:49 +0200 Subject: status line --- play.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 4044dae..d8b8ff0 100644 --- a/play.js +++ b/play.js @@ -206,6 +206,14 @@ function is_action(action, arg) { let on_init_once = false +function on_focus_unit(evt) { + document.getElementById("status").textContent = data.units[evt.target.unit].name +} + +function on_blur(evt) { + document.getElementById("status").textContent = "" +} + function build_units() { function build_unit(u) { let side = is_gov_unit(u) ? "gov" : "fln" @@ -213,8 +221,8 @@ function build_units() { let klass = data.units[u].class elt.className = `counter unit ${side} u${u} ${klass}` elt.addEventListener("mousedown", on_click_unit) - // elt.addEventListener("mouseenter", on_focus_unit) - // elt.addEventListener("mouseleave", on_blur) + elt.addEventListener("mouseenter", on_focus_unit) + elt.addEventListener("mouseleave", on_blur) elt.unit = u } for (let u = 0; u < unit_count; ++u) { -- cgit v1.2.3