summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-10 07:34:49 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-10 07:34:49 +0200
commit7dba9f1fc1823f017168948f817a9bc76971b5a4 (patch)
tree1ca24c521454fb25a127ca36fc61435e47399e71 /play.js
parent1b25d35cdf3b13b04107a3cc96df19f63e6db039 (diff)
downloadalgeria-7dba9f1fc1823f017168948f817a9bc76971b5a4.tar.gz
status line
Diffstat (limited to 'play.js')
-rw-r--r--play.js12
1 files changed, 10 insertions, 2 deletions
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) {