MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / scrollState

Function scrollState

graph-ui/tools/smoke-w9.mjs:510–546  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

508 * drehen. Dieselbe Ausnahme wie in tools/lib/readability.mjs.
509 */
510const scrollState = (page) =>
511 page.evaluate(() => {
512 const regions = [];
513 for (const node of document.body.querySelectorAll('*')) {
514 if (node.closest('.monaco-editor') !== null) {
515 continue;
516 }
517 const style = globalThis.getComputedStyle(node);
518 const scrollsY = (style.overflowY === 'auto' || style.overflowY === 'scroll')
519 && node.scrollHeight > node.clientHeight + 1;
520 const scrollsX = (style.overflowX === 'auto' || style.overflowX === 'scroll')
521 && node.scrollWidth > node.clientWidth + 1;
522 if (!scrollsY && !scrollsX) {
523 continue;
524 }
525 const marks = [
526 ...node.querySelectorAll('[data-scroll-hint]'),
527 ...(node.parentElement === null
528 ? []
529 : [...node.parentElement.children].filter((child) =>
530 child !== node && child.hasAttribute('data-scroll-hint'))),
531 ];
532 regions.push({
533 name: node.getAttribute('data-testid')
534 ?? (node.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)[0]
535 ?? node.tagName.toLowerCase(),
536 top: Math.round(node.scrollTop),
537 left: Math.round(node.scrollLeft),
538 hidden: Math.round(node.scrollHeight - node.clientHeight),
539 hint: marks.map((mark) => mark.getAttribute('data-scroll-hint') ?? '').join(','),
540 });
541 }
542 return {
543 regions,
544 atRest: regions.every((region) => region.top <= 1 && region.left <= 1),
545 };
546 });
547
548/**
549 * Ein Beweisbild im Ruhezustand aufnehmen.

Callers 1

shootAtRestFunction · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected