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