╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ script.js ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
440 grid.addEventListener("click", (event) => { 441 if (event.target.matches("input[readonly]")) { 442 wasmInstance.exports._tick(minRows(), maxCols()); 443 return; 444 } 445 const span = event.target.closest(".clickable"); 446 if (!span) return; 447 // leave modified / non-left clicks (open-in-new-tab, etc.) to the browser 448 if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; 449 // wasm routes the click: an in-page link updates focus and re-renders, 450 // a cross-page one calls _navigate. suppress the <a>'s own navigation so 451 // an in-page link doesn't also trigger a redundant full page load. 452 event.preventDefault(); 453 const focusId = Number(span.dataset.focusId); 454 wasmInstance.exports._onMouseClick(focusId); 455 wasmInstance.exports._tick(minRows(), maxCols()); 456 }); 457 458 let resizeTimer = null; 459 window.addEventListener("resize", () => { 460 clearTimeout(resizeTimer); 461 resizeTimer = setTimeout(() => { 462 wasmInstance.exports._tick(minRows(), maxCols()); 463 }, 100); 464 }); 465 }); 466