From 48da7d71ad368634a93ee329a7a02a78882b7ede Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Fri, 9 Jan 2026 16:33:14 +0100 Subject: [PATCH] fix: Add MutationObserver to continuously hide OpenWrt header - Added startHeaderObserver() for continuous DOM monitoring - Observer watches for new header elements and hides them immediately - Added interval-based backup hiding every 100ms - Ensures OpenWrt header stays hidden even after dynamic content loads Co-Authored-By: Claude Opus 4.5 --- .../resources/secubox-portal/header.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/header.js b/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/header.js index 7ad52b18..1b458844 100644 --- a/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/header.js +++ b/package/secubox/luci-app-secubox-portal/htdocs/luci-static/resources/secubox-portal/header.js @@ -254,6 +254,36 @@ function injectCSS() { document.head.appendChild(style); } +// Continuously watch and hide OpenWrt header elements +var headerObserver = null; +function startHeaderObserver() { + if (headerObserver) return; + + var hideNonSecuBoxHeaders = function() { + document.querySelectorAll('header, .brand, div.brand, header.brand, .main-header, #header').forEach(function(el) { + if (!el.classList.contains('sb-global-header') && !el.closest('.sb-global-header') && !el.closest('.secubox-page-wrapper')) { + el.style.cssText = 'display:none!important;visibility:hidden!important;height:0!important;overflow:hidden!important;'; + } + }); + }; + + // Run immediately + hideNonSecuBoxHeaders(); + + // Watch for DOM changes + headerObserver = new MutationObserver(function(mutations) { + hideNonSecuBoxHeaders(); + }); + + headerObserver.observe(document.body, { + childList: true, + subtree: true + }); + + // Also run on intervals as backup + setInterval(hideNonSecuBoxHeaders, 100); +} + function hideOpenWrtUI() { document.body.classList.add('secubox-mode'); @@ -371,6 +401,7 @@ return baseclass.extend({ render: function() { injectCSS(); hideOpenWrtUI(); + startHeaderObserver(); var activeSection = detectActiveSection();