Remove duplicate Clan CP banner and keep one page scrollbar

This commit is contained in:
unimatrixgit 2026-11-15 14:48:55 +01:00
commit a0a988bcac
6 changed files with 6 additions and 5 deletions

View file

@ -1 +1 @@
export function clanCPDocument(source){return source.replace('<title>DuneRealms · Account Centre</title>','<title>DuneRealms · Clan CP</title>').replace(/<header class="dune-site-header">[\s\S]*?<\/header>/,'').replace(/<footer class="site-footer"><\/footer>/,'').replace(/<script src="https:\/\/www\.dunerealms\.com\/portal-navigation\.js" defer><\/script>/,'').replace(/<link rel="stylesheet" href="https:\/\/www\.dunerealms\.com\/portal-navigation\.css">/,'').replace('<body>','<body data-cp-mode="clan" class="clan-cp-shell">').replace('CONTROL PANEL V2','CLAN CONTROL PANEL').replace('Your imperial workspace','Your household workspace').replace('</body>','<script type="module" src="/v2/cp-v2-clan-size.mjs"></script></body>');}
export function clanCPDocument(source){return source.replace('<title>DuneRealms · Account Centre</title>','<title>DuneRealms · Clan CP</title>').replace(/<header class="dune-site-header">[\s\S]*?<\/header>/,'').replace(/<footer class="site-footer"><\/footer>/,'').replace(/<script src="https:\/\/www\.dunerealms\.com\/portal-navigation\.js" defer><\/script>/,'').replace(/<link rel="stylesheet" href="https:\/\/www\.dunerealms\.com\/portal-navigation\.css">/,'').replace('<body>','<body data-cp-mode="clan" class="clan-cp-shell">').replace(/<section class="command-banner">[\s\S]*?<\/section>/,'').replace('</head>','<link rel="stylesheet" href="/v2/cp-v2-clan-shell.css?v=single-scroll-2"></head>').replace('</body>','<script type="module" src="/v2/cp-v2-clan-size.mjs"></script></body>');}

View file

@ -0,0 +1 @@
html:has(body.clan-cp-shell){overflow:hidden}body.clan-cp-shell{display:flow-root;overflow:visible;min-height:0}.clan-cp-shell .layout{min-height:0}

View file

@ -1,4 +1,4 @@
const outer='https://clans.dunerealms.com';
let queued=false,last=0;function measure(){queued=false;if(parent===window)return;const height=Math.ceil(document.body.getBoundingClientRect().height);if(height!==last&&height>=100&&height<=200000){last=height;parent.postMessage({type:'dune-embed-size',height},outer);}}
let queued=false,last=0;function measure(){queued=false;if(parent===window)return;const height=Math.ceil(Math.max(document.body.scrollHeight,document.body.getBoundingClientRect().height))+2;if(height!==last&&height>=100&&height<=200000){last=height;parent.postMessage({type:'dune-embed-size',height},outer);}}
function schedule(){if(!queued){queued=true;requestAnimationFrame(measure);}}
new ResizeObserver(schedule).observe(document.body);window.addEventListener('message',event=>{if(event.source===parent&&event.origin===outer&&event.data?.type==='dune-embed-measure')schedule();});schedule();

View file

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex,nofollow"><title>Clans &amp; Quests · DuneRealms</title><link rel="stylesheet" href="https://www.dunerealms.com/portal-navigation.css?v=hosting-9-release-1002"><script src="https://www.dunerealms.com/portal-navigation.js?v=canonical-362" defer></script><link rel="stylesheet" href="/clan-shell.css"><script src="/clan-shell.js" defer></script></head><body><header class="dune-site-header"><a class="wordmark" href="https://www.dunerealms.com/" target="_top"><img class="masthead-logo" src="https://www.dunerealms.com/assets/dunerealms-season-logo-v2.webp" alt="dunerealms.com — The Quest for Tavren II Aedrecht — ALPHA" width="360" height="130"></a><button class="menu-toggle" aria-label="Open navigation" aria-expanded="false">☰</button><nav aria-label="Main navigation"><a href="https://www.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-home-v2.webp" alt="" width="34" height="34" decoding="async"><span>Home</span></a><a href="https://www.dunerealms.com/shop.html"><img src="https://www.dunerealms.com/assets/nav-shop-v1.webp" alt="" width="34" height="34" decoding="async"><span>Shop</span></a><a href="https://forums.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-boards-v2.webp" alt="" width="34" height="34" decoding="async"><span>Boards</span></a><a href="https://www.dunerealms.com/staff.html"><img src="https://www.dunerealms.com/assets/nav-staff-v2.webp" alt="" width="34" height="34" decoding="async"><span>Staff roster</span></a><a href="https://www.dunerealms.com/discord.html"><img src="https://www.dunerealms.com/assets/nav-discord-v2.webp" alt="" width="34" height="34" decoding="async"><span>Discord</span></a><a href="https://www.dunerealms.com/exchange.html"><img src="https://www.dunerealms.com/assets/nav-exchange-v2.webp" alt="" width="34" height="34" decoding="async"><span>Exchange</span></a><a href="https://www.dunerealms.com/kits.html"><img src="https://www.dunerealms.com/assets/items/office_water.png" alt="" width="34" height="34" decoding="async"><span>Kit Exchange</span></a><a href="https://support.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-support-v2.webp" alt="" width="34" height="34" decoding="async"><span>Support center</span></a><a href="https://cp.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-account-v2.webp" alt="" width="34" height="34" decoding="async"><span>Account center</span></a><a href="https://clans.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-clan-v2.webp" alt="" width="34" height="34" decoding="async"><span>Clan center</span></a><a href="https://wiki.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-manual-v2.webp" alt="" width="34" height="34" decoding="async"><span>Dunopedia</span></a></nav></header><main class="clan-shell"><iframe id="clan-workspace" src="https://cp.dunerealms.com/clan-cp#clan/clan-overview" title="DuneRealms Clans &amp; Quests account tools" height="1100" referrerpolicy="origin"></iframe><noscript><p><a href="https://cp.dunerealms.com/clan-cp#clan/clan-overview">Open your Clans &amp; Quests account tools</a>. JavaScript is required to manage clan membership.</p></noscript></main><footer><a href="https://www.dunerealms.com/">dunerealms.com</a> · <a href="https://support.dunerealms.com/">Support</a><p>Independent fan project · Not affiliated with Dune rights holders, Mojang or Microsoft.</p></footer></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex,nofollow"><title>Clans &amp; Quests · DuneRealms</title><link rel="stylesheet" href="https://www.dunerealms.com/portal-navigation.css?v=hosting-9-release-1002"><script src="https://www.dunerealms.com/portal-navigation.js?v=canonical-362" defer></script><link rel="stylesheet" href="/clan-shell.css"><script src="/clan-shell.js?v=single-scroll-2" defer></script></head><body><header class="dune-site-header"><a class="wordmark" href="https://www.dunerealms.com/" target="_top"><img class="masthead-logo" src="https://www.dunerealms.com/assets/dunerealms-season-logo-v2.webp" alt="dunerealms.com — The Quest for Tavren II Aedrecht — ALPHA" width="360" height="130"></a><button class="menu-toggle" aria-label="Open navigation" aria-expanded="false">☰</button><nav aria-label="Main navigation"><a href="https://www.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-home-v2.webp" alt="" width="34" height="34" decoding="async"><span>Home</span></a><a href="https://www.dunerealms.com/shop.html"><img src="https://www.dunerealms.com/assets/nav-shop-v1.webp" alt="" width="34" height="34" decoding="async"><span>Shop</span></a><a href="https://forums.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-boards-v2.webp" alt="" width="34" height="34" decoding="async"><span>Boards</span></a><a href="https://www.dunerealms.com/staff.html"><img src="https://www.dunerealms.com/assets/nav-staff-v2.webp" alt="" width="34" height="34" decoding="async"><span>Staff roster</span></a><a href="https://www.dunerealms.com/discord.html"><img src="https://www.dunerealms.com/assets/nav-discord-v2.webp" alt="" width="34" height="34" decoding="async"><span>Discord</span></a><a href="https://www.dunerealms.com/exchange.html"><img src="https://www.dunerealms.com/assets/nav-exchange-v2.webp" alt="" width="34" height="34" decoding="async"><span>Exchange</span></a><a href="https://www.dunerealms.com/kits.html"><img src="https://www.dunerealms.com/assets/items/office_water.png" alt="" width="34" height="34" decoding="async"><span>Kit Exchange</span></a><a href="https://support.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-support-v2.webp" alt="" width="34" height="34" decoding="async"><span>Support center</span></a><a href="https://cp.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-account-v2.webp" alt="" width="34" height="34" decoding="async"><span>Account center</span></a><a href="https://clans.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-clan-v2.webp" alt="" width="34" height="34" decoding="async"><span>Clan center</span></a><a href="https://wiki.dunerealms.com/"><img src="https://www.dunerealms.com/assets/nav-manual-v2.webp" alt="" width="34" height="34" decoding="async"><span>Dunopedia</span></a></nav></header><main class="clan-shell"><iframe id="clan-workspace" src="https://cp.dunerealms.com/clan-cp#clan/clan-overview" title="DuneRealms Clans &amp; Quests account tools" height="1100" scrolling="no" referrerpolicy="origin"></iframe><noscript><p><a href="https://cp.dunerealms.com/clan-cp#clan/clan-overview">Open your Clans &amp; Quests account tools</a>. JavaScript is required to manage clan membership.</p></noscript></main><footer><a href="https://www.dunerealms.com/">dunerealms.com</a> · <a href="https://support.dunerealms.com/">Support</a><p>Independent fan project · Not affiliated with Dune rights holders, Mojang or Microsoft.</p></footer></body></html>

View file

@ -1,4 +1,4 @@
(()=>{const frame=document.getElementById('clan-workspace');if(!frame)return;const cp='https://cp.dunerealms.com',legacy={'clans':'clan/clan-directory','clan-portal':'clan/clan-overview','clan-kits':'clan/clan-tailor','clan-shops':'clan/clan-shop','clan-bank':'clan/clan-bank','clan-settings':'clan/clan-settings','clan-quests':'clan/clan-quests'};
(()=>{const frame=document.getElementById('clan-workspace');if(!frame)return;frame.setAttribute('scrolling','no');frame.addEventListener('load',()=>frame.contentWindow?.postMessage({type:'dune-embed-measure'},'https://cp.dunerealms.com'));const cp='https://cp.dunerealms.com',legacy={'clans':'clan/clan-directory','clan-portal':'clan/clan-overview','clan-kits':'clan/clan-tailor','clan-shops':'clan/clan-shop','clan-bank':'clan/clan-bank','clan-settings':'clan/clan-settings','clan-quests':'clan/clan-quests'};
const valid=value=>/^(?:clan\/(?:clan-(?:overview|roster|requests|settings|directory|mail|bank|shop|tailor|quests|campaigns))|quests\/quests|kits\/kits-exchange|events\/events-calendar)$/.test(value);
function show(){const raw=location.hash.slice(1),route=valid(raw)?raw:legacy[raw]||'clan/clan-overview',url=cp+'/clan-cp#'+route;if(frame.src!==url)frame.src=url;}window.addEventListener('hashchange',show);
window.addEventListener('message',event=>{if(event.origin!==cp||event.source!==frame.contentWindow)return;if(event.data?.type==='dune-embed-size'&&Number.isFinite(event.data.height)&&event.data.height>=100&&event.data.height<=200000)frame.style.height=Math.ceil(event.data.height)+'px';if(event.data?.type==='dune-clan-route'){const route=event.data.workspace+'/'+event.data.page;if(valid(route))history.replaceState(null,'','#'+route);}});show();})();

View file

@ -26,7 +26,7 @@ test('Clan CP uses the same structure with four separate portals and no duplicat
assert.deepEqual(workspacesForSurface(menu.workspaces,true).map(w=>w.id),['clan','quests','kits','events']);
assert.equal(workspacesForSurface(menu.workspaces,false).length,7);
const db=new LocalD1(),app=createPanel(db);try{
const res=await app(new Request('https://cp.dunerealms.com/clan-cp'));assert.equal(res.status,200);const html=await res.text();assert.match(html,/data-cp-mode="clan"/);assert.match(html,/CLAN CONTROL PANEL/);assert.match(html,/id="sidebar-right"/);assert.doesNotMatch(html,/class="dune-site-header"|portal-navigation.js|class="site-footer"/);
const res=await app(new Request('https://cp.dunerealms.com/clan-cp'));assert.equal(res.status,200);const html=await res.text();assert.match(html,/data-cp-mode="clan"/);assert.doesNotMatch(html,/class="command-banner"/);assert.match(html,/cp-v2-clan-shell.css/);assert.match(html,/id="sidebar-right"/);assert.doesNotMatch(html,/class="dune-site-header"|portal-navigation.js|class="site-footer"/);
assert.equal((await app(new Request('https://cp.dunerealms.com/clan-cp',{method:'POST'}))).status,405);
assert.equal((await app(new Request('https://cp.dunerealms.com/v2/cp-v2-clan-size.mjs'))).status,200);
}finally{db.close();}