| 368 | |
| 369 | /** Wo jeder scrollbare Bereich steht. Wortgleich mit smoke-w8b und smoke-w8c. */ |
| 370 | const scrollState = (page) => |
| 371 | page.evaluate(() => { |
| 372 | const regions = []; |
| 373 | for (const node of document.body.querySelectorAll('*')) { |
| 374 | if (node.closest('.monaco-editor') !== null) { |
| 375 | continue; |
| 376 | } |
| 377 | const style = globalThis.getComputedStyle(node); |
| 378 | const scrollsY = (style.overflowY === 'auto' || style.overflowY === 'scroll') |
| 379 | && node.scrollHeight > node.clientHeight + 1; |
| 380 | const scrollsX = (style.overflowX === 'auto' || style.overflowX === 'scroll') |
| 381 | && node.scrollWidth > node.clientWidth + 1; |
| 382 | if (!scrollsY && !scrollsX) { |
| 383 | continue; |
| 384 | } |
| 385 | regions.push({ |
| 386 | name: node.getAttribute('data-testid') |
| 387 | ?? (node.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)[0] |
| 388 | ?? node.tagName.toLowerCase(), |
| 389 | top: Math.round(node.scrollTop), |
| 390 | left: Math.round(node.scrollLeft), |
| 391 | hidden: Math.round(node.scrollHeight - node.clientHeight), |
| 392 | }); |
| 393 | } |
| 394 | return { regions, atRest: regions.every((region) => region.top <= 1 && region.left <= 1) }; |
| 395 | }); |
| 396 | |
| 397 | // ------------------------------------------------------------ Klickstrecke --- |
| 398 | |