╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ script.js ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
442 wasmInstance.exports._setFocus(Number(t.dataset.focusId)); 443 // keyed controls survive a redraw before click. cell links live in the 444 // replaceable backdrop, so their click handler redraws after activation. 445 if (nodeKey(t)?.startsWith("control:")) wasmInstance.exports._tick(minRows(), maxCols()); 446 }); 447 448 grid.addEventListener("click", (event) => { 449 if (event.target.matches("input[readonly]")) { 450 wasmInstance.exports._tick(minRows(), maxCols()); 451 return; 452 } 453 // a link inside a cell's text opens in a new tab on its own 454 if (event.target.closest("a.cell-link")) return; 455 const span = event.target.closest(".clickable"); 456 if (!span) return; 457 // leave modified / non-left clicks (open-in-new-tab, etc.) to the browser 458 if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; 459 // wasm routes the click: an in-page link updates focus and re-renders, 460 // a cross-page one calls _navigate. suppress the <a>'s own navigation so 461 // an in-page link doesn't also trigger a redundant full page load. 462 event.preventDefault(); 463 const focusId = Number(span.dataset.focusId); 464 wasmInstance.exports._onMouseClick(focusId); 465 wasmInstance.exports._tick(minRows(), maxCols()); 466 }); 467 468 let resizeTimer = null; 469 window.addEventListener("resize", () => { 470 clearTimeout(resizeTimer); 471 resizeTimer = setTimeout(() => { 472 wasmInstance.exports._tick(minRows(), maxCols()); 473 }, 100); 474 }); 475 }); 476