| 365 | * Ruhezustand unsichtbar). |
| 366 | */ |
| 367 | const showsMore = (box, edge) => { |
| 368 | const marks = [ |
| 369 | ...box.querySelectorAll('[data-scroll-hint]'), |
| 370 | ...(box.parentElement === null |
| 371 | ? [] |
| 372 | : [...box.parentElement.children].filter((child) => |
| 373 | child !== box && child.hasAttribute('data-scroll-hint'))), |
| 374 | ]; |
| 375 | for (const mark of marks) { |
| 376 | const style = window.getComputedStyle(mark); |
| 377 | const rect = mark.getBoundingClientRect(); |
| 378 | const seen = rect.width > 0 && rect.height > 0 |
| 379 | && style.display !== 'none' && style.visibility !== 'hidden' |
| 380 | && Number(style.opacity) >= 0.05; |
| 381 | const says = (mark.getAttribute('data-scroll-hint') ?? '').split(/\s+/); |
| 382 | if (seen && (says.includes(edge) || says.includes('any'))) { |
| 383 | return { how: 'mark', detail: mark.getAttribute('data-scroll-hint') ?? '' }; |
| 384 | } |
| 385 | } |
| 386 | const style = window.getComputedStyle(box); |
| 387 | const masks = [style.maskImage, style.webkitMaskImage] |
| 388 | .filter((value) => typeof value === 'string' && value.length > 0 && value !== 'none'); |
| 389 | if (masks.length > 0) { |
| 390 | return { how: 'mask', detail: masks[0].slice(0, 60) }; |
| 391 | } |
| 392 | /* |
| 393 | * Ein Verlauf, der ueber dieser Kante liegt: ein sichtbares Geschwister |
| 394 | * im selben Rahmen, das die Kante beruehrt und einen Farbverlauf malt. |
| 395 | * Die Tab-Leiste macht es so (zwei Streifen an den Raendern, die nur |
| 396 | * erscheinen, wenn wirklich etwas herausragt), und diese Form ist |
| 397 | * genauso ein Hinweis wie eine Marke: der Leser sieht, dass der Text |
| 398 | * dort nicht endet, sondern weitergeht. |
| 399 | */ |
| 400 | const boxRect = box.getBoundingClientRect(); |
| 401 | const near = 26; |
| 402 | for (const other of box.parentElement === null ? [] : box.parentElement.children) { |
| 403 | if (other === box) { |
| 404 | continue; |
| 405 | } |
| 406 | const otherStyle = window.getComputedStyle(other); |
| 407 | if (!/gradient/.test(otherStyle.backgroundImage ?? '')) { |
| 408 | continue; |
| 409 | } |
| 410 | if (otherStyle.display === 'none' || otherStyle.visibility === 'hidden' |
| 411 | || Number(otherStyle.opacity) < 0.05) { |
| 412 | continue; |
| 413 | } |
| 414 | const rect = other.getBoundingClientRect(); |
| 415 | const touches = edge === 'bottom' |
| 416 | ? Math.abs(rect.bottom - boxRect.bottom) <= near && rect.top < boxRect.bottom |
| 417 | : edge === 'top' |
| 418 | ? Math.abs(rect.top - boxRect.top) <= near && rect.bottom > boxRect.top |
| 419 | : edge === 'right' |
| 420 | ? Math.abs(rect.right - boxRect.right) <= near && rect.left < boxRect.right |
| 421 | : Math.abs(rect.left - boxRect.left) <= near && rect.right > boxRect.left; |
| 422 | if (touches) { |
| 423 | return { how: 'gradient-edge', detail: identify(other) }; |
| 424 | } |