From de489467123f2a62f3f8c7a0af68f8f8bdb0cef0 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 25 Nov 2026 08:54:55 +0100 Subject: [PATCH 1/4] Restore original homepage header and prevent banner regression --- website/scripts/build.mjs | 4 ++-- website/scripts/site-chrome.mjs | 15 ++++++++++++--- website/tests/site-chrome.test.mjs | 13 ++++++++++--- website/web/realm-design.js | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/website/scripts/build.mjs b/website/scripts/build.mjs index 798305ce..8cd69f20 100644 --- a/website/scripts/build.mjs +++ b/website/scripts/build.mjs @@ -38,10 +38,10 @@ if(!legalNotice)throw Error('Homepage legal notice is missing'); function preparePublicHtml(html,file){ html=applyRealmPageDesign(html,file); // A single template owns the chrome; page content and service forms remain local. - html=applySharedHeader(html,SHARED_HEADER); + html=applySharedHeader(html,SHARED_HEADER,file); html=applySharedFooter(html); // All page families retain one shared notice, including generated documents. - let result=//.test(html)?html:updatePortalNavigation(html); + let result=file==='index.html'||//.test(html)?html:updatePortalNavigation(html); if(!result.includes('class="legal-notice"')){ if(!result.includes(''))throw Error('Public HTML page missing closing body'); result=result.replace('',legalNotice+''); diff --git a/website/scripts/site-chrome.mjs b/website/scripts/site-chrome.mjs index 5cd72c90..dda88a02 100644 --- a/website/scripts/site-chrome.mjs +++ b/website/scripts/site-chrome.mjs @@ -9,23 +9,32 @@ export function applySharedFooter(html){ } export const SHARED_FOOTER_SCRIPT=`(()=>{if(window.top!==window.self)return;const html=${JSON.stringify(SHARED_FOOTER)};let footer=document.querySelector('body>footer,.dune-shared-footer');if(footer?.dataset.sharedChrome==='3')return;const memorial=document.querySelector('.dune-memorial');const template=document.createElement('template');template.innerHTML=html;const fresh=template.content.firstElementChild;if(memorial)fresh.append(memorial);if(footer)footer.replaceWith(fresh);else document.body.append(fresh);})();`; -export function applySharedHeader(html,header){ +export function applySharedHeader(html,header,label){ + if(label==='index.html'&&hasOriginalHomepageHeader(html))return html; if(/]*class="[^"]*dune-site-header/.test(html))return html.replace(/]*class="[^"]*dune-site-header[^"]*"[^>]*>[\s\S]*?<\/header>/,header); - // Homepage content/dialogs stay intact; only its formerly separate masthead/navigation are replaced. + // Non-homepage legacy mastheads are compiled into the shared header as before. if(html.includes('
')){ const start=html.indexOf('
'),end=html.indexOf('\{if\(window.top!==window.self\)\{document.documentElement.classList.add\('dune-embedded'\);return;\}const links=[\s\S]*?\}\)\(\);/g,'');} +function hasOriginalHomepageHeader(html){ + const main=html.indexOf(''),masthead=html.indexOf('
'),nav=html.indexOf('