| 400 | |
| 401 | /** Der Zustand der Frage nach dem Warum und dessen, was hinter ihr liegt. */ |
| 402 | const whyState = (page) => |
| 403 | page.evaluate(() => ({ |
| 404 | why: document.querySelector('[data-testid="atlas-why"]') !== null, |
| 405 | decline: document.querySelector('[data-testid="atlas-why-decline"]') |
| 406 | ?.textContent?.trim() ?? '', |
| 407 | readerPath: globalThis.__atlasReader?.document?.path ?? '', |
| 408 | breadcrumb: document.querySelector('[data-testid="atlas-breadcrumb"]') |
| 409 | ?.textContent?.replace(/\s+/g, ' ').trim() ?? '', |
| 410 | readerVisible: (() => { |
| 411 | const reader = document.querySelector('[data-testid="atlas-reader"]'); |
| 412 | if (reader === null) { |
| 413 | return false; |
| 414 | } |
| 415 | const rect = reader.getBoundingClientRect(); |
| 416 | if (rect.width <= 0 || rect.height <= 0) { |
| 417 | return false; |
| 418 | } |
| 419 | /* |
| 420 | * Nicht nur "es gibt einen Reader", sondern "in seiner Mitte liegt |
| 421 | * er selbst obenauf". Genau das war der Befund: der Klick wirkte, |
| 422 | * die Datei war offen, und davor stand die Frage. |
| 423 | */ |
| 424 | const at = document.elementFromPoint( |
| 425 | Math.round(rect.left + rect.width / 2), |
| 426 | Math.round(rect.top + rect.height / 2), |
| 427 | ); |
| 428 | return at !== null && reader.contains(at); |
| 429 | })(), |
| 430 | })); |
| 431 | |
| 432 | /** Der Twin, mit der Frage, ob seine Kante etwas sagt. */ |
| 433 | const twinEdge = (page) => |