Spaces:
Running
Running
Scrolling: wheel fallback, answer scroll area, jump to answer
Browse files67 unmodified lines686970717273747567 unmodified lines}function showAnswer(text, short) {ui.answer.hidden = false; ui.short.textContent = short || ''; linkify(ui.report, text.trim());}// ---------------------------------------------------------------- tools (run in this page: tools.js)async function callTool(name, args, signal) {setSignal(signal);67 unmodified lines68697071727374757677787980818283848586878867 unmodified lines}function showAnswer(text, short) {ui.answer.hidden = false; ui.short.textContent = short || ''; linkify(ui.report, text.trim());ui.answer.scrollIntoView({ block: 'start' }); // land on the start of the answer}// Belt and braces for iframes that swallow wheel scrolling (seen in the Space's embedded view): if a wheel turn did not move anything,// scroll the page ourselves. An inner scroller (a step's output) that did take the wheel is left alone.addEventListener('wheel', (e) => {if (e.ctrlKey || e.defaultPrevented) return;const page = document.body, inner = e.target.closest?.('pre, .think, #report'), b0 = page.scrollTop, i0 = inner ? inner.scrollTop : 0;requestAnimationFrame(() => requestAnimationFrame(() => {if (page.scrollTop !== b0 || (inner && inner.scrollTop !== i0)) return;const dy = e.deltaMode === 1 ? e.deltaY * 40 : e.deltaMode === 2 ? e.deltaY * page.clientHeight : e.deltaY, max = page.scrollHeight - page.clientHeight;if ((dy > 0 && b0 < max) || (dy < 0 && b0 > 0)) page.scrollTop = b0 + dy;}));}, { passive: true });// ---------------------------------------------------------------- tools (run in this page: tools.js)async function callTool(name, args, signal) {setSignal(signal);
34 unmodified lines3536373839404134 unmodified lines#answer h2 { margin: 4px 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }#short { margin: 4px 0 8px; font-size: 20px; font-weight: 600; }#short:empty { display: none; }#report { white-space: pre-wrap; overflow-wrap: anywhere; }#trail { display: grid; gap: 6px; }.step { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13.5px; }34 unmodified lines3536373839404134 unmodified lines#answer h2 { margin: 4px 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }#short { margin: 4px 0 8px; font-size: 20px; font-weight: 600; }#short:empty { display: none; }#report { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 70vh; overflow-y: auto; } /* the answer scrolls by itself too */#trail { display: grid; gap: 6px; }.step { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13.5px; }
main.js+13
style.css+1-1