summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/play.js b/play.js
index f417009..75c7c3d 100644
--- a/play.js
+++ b/play.js
@@ -76,6 +76,24 @@ let ui = {
present: new Set(),
}
+function on_focus_area_tip(x) {
+ ui.areas[x].classList.add("tip")
+}
+
+function on_blur_area_tip(x) {
+ ui.areas[x].classList.remove("tip")
+}
+
+function on_click_area_tip(x) {
+ ui.areas[x].scrollIntoView({ block:"center", inline:"center", behavior:"smooth" })
+}
+
+function sub_area_name(match, p1, offset, string) {
+ let x = p1 | 0
+ let n = AREAS[x].name
+ return `<span class="tip" onmouseenter="on_focus_area_tip(${x})" onmouseleave="on_blur_area_tip(${x})" onclick="on_click_area_tip(${x})">${n}</span>`
+}
+
function on_log(text) {
let p = document.createElement("div")
@@ -92,6 +110,8 @@ function on_log(text) {
text = text.replace(/^([A-Z]):/, '<span class="$1"> $1 </span>')
+ text = text.replace(/#(\d+)/g, sub_area_name)
+
if (text.match(/^\.h1 /))
p.className = 'h1', text = text.substring(4)
if (text.match(/^\.h2 E/))