| 1 |
const PART_ATTR = 'data-extendify-part'; |
| 2 |
|
| 3 |
// A header wearing any of these is positioned by the theme, not inline CSS. |
| 4 |
const HEADER_CLASSES = [ |
| 5 |
'ext-header-sticky', |
| 6 |
'ext-header-sticky--floating-pill', |
| 7 |
'ext-header-overlay', |
| 8 |
'ext-header-glass', |
| 9 |
'ext-header--dark', |
| 10 |
]; |
| 11 |
|
| 12 |
const headerBlockEl = () => |
| 13 |
[...document.querySelectorAll(`[${PART_ATTR}="header"]`)].find( |
| 14 |
(el) => !el.parentElement?.closest(`[${PART_ATTR}="header"]`), |
| 15 |
) ?? null; |
| 16 |
|
| 17 |
export const isExtendableHeader = () => { |
| 18 |
const el = headerBlockEl(); |
| 19 |
if (!el) return false; |
| 20 |
const classes = String(el.className).split(/\s+/); |
| 21 |
return HEADER_CLASSES.some((cls) => classes.includes(cls)); |
| 22 |
}; |
| 23 |
|