╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ script.js ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
364 }); 365 366 grid.addEventListener("click", (event) => { 367 const span = event.target.closest(".clickable"); 368 if (!span) return; 369 // leave modified / non-left clicks (open-in-new-tab, etc.) to the browser 370 if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; 371 // wasm routes the click: an in-page link updates focus and re-renders, 372 // a cross-page one calls _navigate. suppress the <a>'s own navigation so 373 // an in-page link doesn't also trigger a redundant full page load. 374 event.preventDefault(); 375 const focusId = Number(span.dataset.focusId); 376 wasmInstance.exports._onMouseClick(focusId); 377 wasmInstance.exports._tick(minRows(), maxCols()); 378 }); 379 380 let resizeTimer = null; 381 window.addEventListener("resize", () => { 382 clearTimeout(resizeTimer); 383 resizeTimer = setTimeout(() => { 384 wasmInstance.exports._tick(minRows(), maxCols()); 385 }, 100); 386 }); 387 }); 388