| 555 | |
| 556 | /** Wo jeder scrollbare Bereich steht. Wortgleich mit smoke-w9/w10. */ |
| 557 | const scrollState = (page) => |
| 558 | page.evaluate(() => { |
| 559 | const regions = []; |
| 560 | for (const node of document.body.querySelectorAll('*')) { |
| 561 | if (node.closest('.monaco-editor') !== null) { |
| 562 | continue; |
| 563 | } |
| 564 | const style = globalThis.getComputedStyle(node); |
| 565 | const scrollsY = (style.overflowY === 'auto' || style.overflowY === 'scroll') |
| 566 | && node.scrollHeight > node.clientHeight + 1; |
| 567 | const scrollsX = (style.overflowX === 'auto' || style.overflowX === 'scroll') |
| 568 | && node.scrollWidth > node.clientWidth + 1; |
| 569 | if (!scrollsY && !scrollsX) { |
| 570 | continue; |
| 571 | } |
| 572 | regions.push({ |
| 573 | name: node.getAttribute('data-testid') |
| 574 | ?? (node.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)[0] |
| 575 | ?? node.tagName.toLowerCase(), |
| 576 | top: Math.round(node.scrollTop), |
| 577 | left: Math.round(node.scrollLeft), |
| 578 | hidden: Math.round(node.scrollHeight - node.clientHeight), |
| 579 | }); |
| 580 | } |
| 581 | return { regions, atRest: regions.every((region) => region.top <= 1 && region.left <= 1) }; |
| 582 | }); |
| 583 | |
| 584 | // ------------------------------------------------------------ Klickstrecke --- |
| 585 | |