diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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/)) |