╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ script.js ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
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