| 844 | * den Kopf. |
| 845 | */ |
| 846 | const scrollState = (page) => |
| 847 | page.evaluate(() => { |
| 848 | const regions = []; |
| 849 | for (const node of document.body.querySelectorAll('*')) { |
| 850 | if (node.closest('.monaco-editor') !== null) { |
| 851 | continue; |
| 852 | } |
| 853 | const style = globalThis.getComputedStyle(node); |
| 854 | const scrollsY = (style.overflowY === 'auto' || style.overflowY === 'scroll') |
| 855 | && node.scrollHeight > node.clientHeight + 1; |
| 856 | const scrollsX = (style.overflowX === 'auto' || style.overflowX === 'scroll') |
| 857 | && node.scrollWidth > node.clientWidth + 1; |
| 858 | if (!scrollsY && !scrollsX) { |
| 859 | continue; |
| 860 | } |
| 861 | regions.push({ |
| 862 | name: node.getAttribute('data-testid') |
| 863 | ?? (node.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)[0] |
| 864 | ?? node.tagName.toLowerCase(), |
| 865 | top: Math.round(node.scrollTop), |
| 866 | left: Math.round(node.scrollLeft), |
| 867 | hidden: Math.round(node.scrollHeight - node.clientHeight), |
| 868 | }); |
| 869 | } |
| 870 | return { regions, atRest: regions.every((region) => region.top <= 1 && region.left <= 1) }; |
| 871 | }); |
| 872 | |
| 873 | // -------------------------------------------------------- Klickstrecke ------ |
| 874 | |