diff --git a/banner.js b/banner.js index fa09c10..aef0950 100644 --- a/banner.js +++ b/banner.js @@ -4,6 +4,7 @@ // incrementversion DISMISSED_KEY const DISMISSED_KEY = 'jf-banner-dismissed-v1'; const BANNER_ID = 'custom-announcement-banner'; + const SCRIPT_START = Date.now(); // Edit these to change banner content: const BANNER_HTML = ` @@ -100,7 +101,10 @@ offsetElements.add(el); }); - if (offsetPx > 0 && candidates.size === 0) { + // Jellyfin's SPA mounts its header asynchronously after DOMContentLoaded, + // so an empty result in the first few seconds is expected, not a bug. + // Only warn once things have had time to settle. + if (offsetPx > 0 && candidates.size === 0 && Date.now() - SCRIPT_START > 4000) { console.warn('[custom-banner] No fixed top navigation elements detected to push down; banner may overlap the menu.'); } }