diff --git a/website/integrations/mybb/inc/plugins/dune_sections.php b/website/integrations/mybb/inc/plugins/dune_sections.php index d36eae24..579cdedc 100644 --- a/website/integrations/mybb/inc/plugins/dune_sections.php +++ b/website/integrations/mybb/inc/plugins/dune_sections.php @@ -33,13 +33,13 @@ function dune_sections_index(){ if($system){$label=empty($collapsed[$key.'_e'])?'Collapse System Boards':'Expand System Boards';$toggle='
'.$label.'
';} $html.='
'.$toggle.'

COMMUNITY FORUMS

'.dune_sections_escape($root['name']).'

'; if($system)$html.='
'; - $html.='
Subcategories'.dune_sections_links($panels).'
'; + $html.='
'; foreach($panels as$panel){ $children=dune_sections_children((int)$panel['fid'],$all); $html.='

'.dune_sections_escape($panel['name']).'

'.dune_sections_escape(strip_tags($panel['description'])).'

SUBCATEGORY
'; $previous=$mybb->settings['hideprivateforums'];$mybb->settings['hideprivateforums']=1; try{ - if($children){$html.='
Forums'.dune_sections_links($children).'
';$rows=build_forumbits((int)$panel['fid'],2);} + if($children){$rows=build_forumbits((int)$panel['fid'],2);} elseif($panel['type']==='f'){ $copy=$panel;$copy['name']='Discussions';$copy['description']='';$virtual=-991; $before=$fcache[$virtual]??null;$fcache[$virtual]=[0=>[(int)$panel['fid']=>$copy]]; @@ -47,6 +47,7 @@ function dune_sections_index(){ }else $rows=null; }finally{$mybb->settings['hideprivateforums']=$previous;} if($rows&&!empty($rows['forum_list']))$html.=''.$rows['forum_list'].'
ForumThreadsPostsLast post
'; + else if($children)$html.='
Forums'.dune_sections_links($children).'
'; else $html.='

No visible forums in this section.

'; $html.='
'; } diff --git a/website/ops/publish-realm-design.py b/website/ops/publish-realm-design.py index 6a20f2d2..3b5ae881 100644 --- a/website/ops/publish-realm-design.py +++ b/website/ops/publish-realm-design.py @@ -6,8 +6,8 @@ release=pathlib.Path('/home/dunerealms/apps/dunerealms/current').resolve(strict= assert release.name=='ci-'+args.expected_release base=pathlib.Path('/home/dunerealms/apps/integrations').resolve(strict=True) node='/home/dunerealms/.nvm/versions/node/v22.23.3/bin/node' -result=subprocess.run([node,'--input-type=module','-e',"import {SHARED_HEADER,SHARED_HEAD} from './scripts/portal-navigation.mjs';console.log(JSON.stringify({header:SHARED_HEADER,head:SHARED_HEAD}));"],cwd=release,capture_output=True,text=True,check=True) -chrome=json.loads(result.stdout);script=(release/'web/realm-design.js').read_text();css=(release/'web/realm-design.css').read_text();assert '__duneRealmDesign' in script and 'dr-native' in css and 'dr-header-brand' in chrome['header'] +result=subprocess.run([node,'--input-type=module','-e',"import {SHARED_HEADER,SHARED_HEAD} from './scripts/portal-navigation.mjs';import {sharedHomepageHeaderScript} from './scripts/homepage-header.mjs';console.log(JSON.stringify({header:SHARED_HEADER,head:SHARED_HEAD,runtime:sharedHomepageHeaderScript()}));"],cwd=release,capture_output=True,text=True,check=True) +chrome=json.loads(result.stdout);script=(release/'web/realm-design.js').read_text()+chrome['runtime'];support_css=(release/'scripts/osticket-presentation.css').read_text();forum_css=(release/'scripts/mybb-presentation.css').read_text();css=(release/'web/realm-design.css').read_text()+'\n'+(release/'scripts/homepage-header.css').read_text()+'\n'+support_css+'\n'+forum_css;assert '__duneRealmDesign' in script and 'dr-native' in css and 'data-shared-header-source="homepage"' in chrome['header'] start='/* DUNE REALM DESIGN START */';end='/* DUNE REALM DESIGN END */' def append(old,content): if start in old: @@ -19,12 +19,17 @@ native_head=chrome['head'].replace('href="/portal-navigation.css"','href="https: # already includes realm-design.js. Keep their existing script security policy. native_head=re.sub(r']*src="[^"]*/realm-design\.js[^>]*>','',native_head) changes={'shared-header.html':chrome['header'],'shared-header-head.html':native_head} -hook=base/'shared-header.php';original_hook=hook.read_text();assert 'v=canonical-362' in original_hook or 'v=realm-design-1' in original_hook -changes['shared-header.php']=original_hook.replace('v=canonical-362','v=realm-design-1') +hook=base/'shared-header.php';original_hook=hook.read_text();assert any(v in original_hook for v in ('v=canonical-362','v=realm-design-1','v=template-fix-6000')) +changes['shared-header.php']=original_hook.replace('v=canonical-362','v=template-fix-6000').replace('v=realm-design-1','v=template-fix-6000').replace('dune-osticket-theme.css?v=20261103-alpha','dune-osticket-theme.css?v=template-fix-6000').replace('dune-forum-polish.css?v=328-1','dune-forum-polish.css?v=template-fix-6000') for app in ['mybb','osticket']: for ext,content in [('js',(release/'dist/shared-chrome/portal-navigation.js').read_text()),('css',(release/'dist/shared-chrome/portal-navigation.css').read_text()+'\n'+re.sub(r'^@import[^;]+;\s*','',css))]: relative=app+'/dune-navigation.'+ext;target=(base/relative).resolve(strict=True);assert target.is_relative_to(base) changes[relative]=content +support_theme=(base/'osticket/dune-osticket-theme.css').resolve(strict=True);assert support_theme.is_relative_to(base) +changes['osticket/dune-osticket-theme.css']=append(support_theme.read_text(),support_css) +forum_theme=(base/'mybb/dune-forum-polish.css').resolve(strict=True);assert forum_theme.is_relative_to(base) +changes['mybb/dune-forum-polish.css']=append(forum_theme.read_text(),forum_css) +changes['mybb/inc/plugins/dune_sections.php']=(release/'integrations/mybb/inc/plugins/dune_sections.php').read_text() targets={name:(base/name).resolve(strict=True) for name in changes} assert all(target.is_relative_to(base) for target in targets.values()) # The standalone shop host keeps its own document and iframe bridge. diff --git a/website/scripts/build.mjs b/website/scripts/build.mjs index 798305ce..22687e87 100644 --- a/website/scripts/build.mjs +++ b/website/scripts/build.mjs @@ -1,5 +1,6 @@ import {applySharedHeader,applySharedFooter,SHARED_FOOTER_SCRIPT,cleanLegacyChromeScript,assertSharedChrome} from './site-chrome.mjs'; import {SHARED_HEADER} from './portal-navigation.mjs'; +import {sharedHomepageHeaderScript} from './homepage-header.mjs'; import {applyRealmPageDesign} from './realm-page-design.mjs'; import {publishExchangeAssets} from './public-exchange-assets.mjs'; import {createHash} from 'node:crypto'; @@ -13,8 +14,10 @@ import{updatePortalNavigation}from'./portal-navigation.mjs'; import {readFileSync,writeFileSync as writePlain,renameSync,unlinkSync,openSync,writeSync,closeSync,readdirSync,statSync,mkdirSync,existsSync,rmSync,cpSync} from 'node:fs';import path from 'node:path';import {fileURLToPath} from 'node:url'; function writeFileSync(file,content){const temporary=file+'.build-'+process.pid;writePlain(temporary,content);renameSync(temporary,file);} const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'),web=path.join(root,'web'),dist=path.join(root,'dist'); +const sharedRealmRuntime=readFileSync(path.join(web,'realm-design.js'),'utf8')+sharedHomepageHeaderScript(); +const sharedRealmCSS=Buffer.concat([readFileSync(path.join(web,'realm-design.css')),readFileSync(new URL('./homepage-header.css',import.meta.url)),readFileSync(new URL('./osticket-presentation.css',import.meta.url)),readFileSync(new URL('./mybb-presentation.css',import.meta.url))]); // Embedded workspaces execute the same runtime through their permitted origin. -writeFileSync(path.join(root,'control-panel/public/cp-v2/cp-v2-realm-design.mjs'),readFileSync(path.join(web,'realm-design.js'))); +writeFileSync(path.join(root,'control-panel/public/cp-v2/cp-v2-realm-design.mjs'),sharedRealmRuntime); // CP entry documents are served directly by the existing CP process. Compile their // shared chrome from the same templates as public pages, without altering forms. function compileCPChrome(directory){for(const entry of readdirSync(directory,{withFileTypes:true})){const file=path.join(directory,entry.name);if(entry.isDirectory()){if(entry.name!=='native-editor')compileCPChrome(file);continue;}if(!entry.name.endsWith('.html'))continue;const old=readFileSync(file,'utf8');if(!old.includes('dune-site-header'))continue;const next=assertSharedChrome(applySharedFooter(applySharedHeader(old,SHARED_HEADER)),SHARED_HEADER,file);if(next!==old)writeFileSync(file,next);}} @@ -38,10 +41,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+''); @@ -52,7 +55,7 @@ function preparePublicHtml(html,file){ publishExchangeAssets(path.join(root,'control-panel/public'),web); writeFileSync(path.join(web,'rates-and-charges.html'),applyRealmPageDesign(bankRatesPage(),'rates-and-charges.html')); let assetCount=0;let assetWriter=null,shardSize=0;const shardNames=[];let shardTemporary;function openShard(){shardTemporary=path.join(dist,'server','.assets-build-'+process.pid);assetWriter=openSync(shardTemporary,'w');writeSync(assetWriter,'export default {');shardSize=0;}function closeShard(){writeSync(assetWriter,'};\n');closeSync(assetWriter);const hash=createHash('sha256').update(readFileSync(shardTemporary)).digest('hex'),name='assets-'+hash+'.mjs',target=path.join(dist,'server',name);if(existsSync(target))unlinkSync(shardTemporary);else renameSync(shardTemporary,target);shardNames.push(name);}function writeAsset(entry){if(shardSize>32*1024*1024){closeShard();openShard();}writeSync(assetWriter,entry);shardSize+=Buffer.byteLength(entry);}const types={'.html':'text/html; charset=utf-8','.css':'text/css; charset=utf-8','.js':'text/javascript; charset=utf-8','.mjs':'text/javascript; charset=utf-8','.json':'application/json; charset=utf-8','.webp':'image/webp','.png':'image/png','.mp4':'video/mp4','.pdf':'application/pdf','.zip':'application/zip','.svg':'image/svg+xml'}; -function collect(directory){for(const entry of readdirSync(directory).sort()){const p=path.join(directory,entry);if(statSync(p).isDirectory())collect(p);else{const relative=path.relative(web,p).split(path.sep).join('/');if(/^assets\/seals\/[^/]+-provenance\.txt$/.test(relative)||/^assets\/organisation-deed(?:s)?-[a-z0-9-]+\.png$/.test(relative))continue;const type=types[path.extname(entry)];if(!type)throw Error('Unexpected asset: '+entry);const bytes=readFileSync(p);const payload=relative.endsWith('.html')?Buffer.from(preparePublicHtml(bytes.toString('utf8'),relative)):relative==='portal-navigation.js'?Buffer.from(SHARED_FOOTER_SCRIPT+withRealmSwitch(withCanonicalMenu(withMenuBadges(cleanLegacyChromeScript(bytes.toString('utf8')))))+readFileSync(path.join(web,'realm-design.js'),'utf8')):relative==='portal-navigation.css'?Buffer.concat([bytes,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS+readFileSync(path.join(web,"realm-comfort.css"),"utf8"))]):bytes;writeAsset(JSON.stringify('/'+relative)+':['+JSON.stringify(type)+','+JSON.stringify(payload.toString('base64'))+'],');assetCount++}}} +function collect(directory){for(const entry of readdirSync(directory).sort()){const p=path.join(directory,entry);if(statSync(p).isDirectory())collect(p);else{const relative=path.relative(web,p).split(path.sep).join('/');if(/^assets\/seals\/[^/]+-provenance\.txt$/.test(relative)||/^assets\/organisation-deed(?:s)?-[a-z0-9-]+\.png$/.test(relative))continue;const type=types[path.extname(entry)];if(!type)throw Error('Unexpected asset: '+entry);const bytes=readFileSync(p);const payload=relative.endsWith('.html')?Buffer.from(preparePublicHtml(bytes.toString('utf8'),relative)):relative==='realm-design.js'?Buffer.from(sharedRealmRuntime):relative==='realm-design.css'?sharedRealmCSS:relative==='portal-navigation.js'?Buffer.from(SHARED_FOOTER_SCRIPT+withRealmSwitch(withCanonicalMenu(withMenuBadges(cleanLegacyChromeScript(bytes.toString('utf8')))))+sharedRealmRuntime):relative==='portal-navigation.css'?Buffer.concat([bytes,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS+readFileSync(path.join(web,"realm-comfort.css"),"utf8"))]):bytes;writeAsset(JSON.stringify('/'+relative)+':['+JSON.stringify(type)+','+JSON.stringify(payload.toString('base64'))+'],');assetCount++}}} mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'.openai'),{recursive:true});const workerTemporary=path.join(dist,'server/index.js.build-'+process.pid);process.once('exit',()=>{if(existsSync(workerTemporary))try{unlinkSync(workerTemporary);}catch{}});openShard();collect(web);const buildCommit=process.env.GITHUB_SHA;if(buildCommit&&/^[0-9a-f]{40}$/.test(buildCommit)){writeAsset(JSON.stringify('/ci-build.json')+':'+JSON.stringify(['application/json; charset=utf-8',Buffer.from(JSON.stringify({commit:buildCommit})).toString('base64')])+',');}closeShard(); let api=['public-item-metadata.mjs','feed-api.mjs','exchange-api.mjs','forum-api.mjs','community-api.mjs','portal-api.mjs'].map(file=>readFileSync(path.join(root,'worker',file),'utf8').replace(/^import .*;$/gm,'').replace(/export /g,'')).join('\n');let runtime=readFileSync(path.join(root,'worker/runtime.mjs'),'utf8').replace(/^import .*;$/gm,''); writeFileSync(path.join(dist,'server/index.js'),shardNames.map((name,i)=>'import DATA'+i+' from '+JSON.stringify('./'+name)+';').join('\n')+'\nconst ASSET_DATA=Object.assign({},'+shardNames.map((_,i)=>'DATA'+i).join(',')+');\n'+api+'\n'+runtime);cpSync(path.join(root,'.openai/hosting.json'),path.join(dist,'.openai/hosting.json'));console.log('Built Worker with',assetCount,'embedded website assets'); @@ -63,7 +66,7 @@ if(existsSync(path.join(root,'drizzle')))cpSync(path.join(root,'drizzle'),path.j const shared=path.join(dist,'shared-chrome');mkdirSync(shared,{recursive:true}); for(const name of ['portal-navigation.js','portal-navigation.css','release.json','menu-new-items.json','rates-and-charges.html','bank-rates.css']){ let content=readFileSync(path.join(web,name)); - if(name==='portal-navigation.js')content=Buffer.from(SHARED_FOOTER_SCRIPT+withRealmSwitch(withCanonicalMenu(withMenuBadges(cleanLegacyChromeScript(content.toString('utf8')))))+readFileSync(path.join(web,'realm-design.js'),'utf8')); + if(name==='portal-navigation.js')content=Buffer.from(SHARED_FOOTER_SCRIPT+withRealmSwitch(withCanonicalMenu(withMenuBadges(cleanLegacyChromeScript(content.toString('utf8')))))+sharedRealmRuntime); if(name==='portal-navigation.css')content=Buffer.concat([content,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS+readFileSync(path.join(web,"realm-comfort.css"),"utf8"))]); if(name.endsWith('.html'))content=Buffer.from(preparePublicHtml(content.toString('utf8'),name)); writeFileSync(path.join(shared,name),content); diff --git a/website/scripts/homepage-header.css b/website/scripts/homepage-header.css new file mode 100644 index 00000000..e7c4331d --- /dev/null +++ b/website/scripts/homepage-header.css @@ -0,0 +1,17 @@ +/* Shared host is intentionally isolated from native forum/CP/shop styles. The original + homepage portal.css and sections.css supply the component's actual layout. */ +dune-shared-header{display:block!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important;position:relative!important;z-index:120!important;flex:none!important} +dune-shared-header[hidden]{display:none!important} +:host{display:block;color-scheme:dark;--ink:#071a16;--surface:#102a23;--surface-raised:#17372c;--gold:#c9a85a;--gold-light:#f2d593;--cream:#f5ead0;--muted:#a8b8ac;--line:#6b613d;--font:'DM Sans',Arial,sans-serif;--serif:'Cinzel',Georgia,serif;color:var(--cream);font:16px/1.65 var(--font);text-align:left} +:host .nav-bar{position:relative;z-index:20} +:host [hidden]{display:none!important} +:host .nav-actions .button{min-height:42px;font-size:14px;border-radius:4px;font-family:var(--font);font-weight:700} +:host .shared-account-group{position:relative} +:host .shared-account-group>summary{list-style:none;cursor:pointer} +:host .shared-account-group>.dropdown{right:0;left:auto} +:host .shared-current{color:var(--gold-light);position:relative} +:host .shared-current:after{position:absolute;content:'';height:2px;background:var(--gold);bottom:0;left:16px;right:16px} +:host .nav-home:not([aria-current=page]):after{display:none} +:host .shared-menu-badge{display:inline-block;margin-left:6px;font-size:9px;color:var(--gold-light)} +@media(max-width:850px){:host .shared-account-group{display:none}} +@media(max-width:640px){:host .nav-actions .button{min-height:35px;font-size:11px}} diff --git a/website/scripts/homepage-header.mjs b/website/scripts/homepage-header.mjs new file mode 100644 index 00000000..d47f0a78 --- /dev/null +++ b/website/scripts/homepage-header.mjs @@ -0,0 +1,73 @@ +import {readFileSync} from 'node:fs'; +import {MAIN_MENU_GROUPS} from './main-menu.mjs'; +const root='https://www.dunerealms.com'; +export function homepageHeaderTemplate(html){ + const start=html.indexOf('
'),end=html.indexOf('')||!template.includes('id="portal-navigation"'))throw Error('Original homepage header invalid'); + return template.replace(/(href|src)="\/(?!\/)/g,'$1="'+root+'/'); +} +export function mountSharedHomepageHeader(template,groups,root){ + if(window.__duneHomepageHeaderMounted||window.top!==window.self)return; + const old=document.querySelector('header.dune-site-header'); + const original=document.querySelector('header.masthead'); + const utility=(original||old)?.previousElementSibling,bar=(original||old)?.nextElementSibling; + if(!old&&!(original&&utility?.classList.contains('utility')&&bar?.classList.contains('nav-bar')))return; + window.__duneHomepageHeaderMounted=true; + const home=!!document.querySelector('.arrival-grid')&&!!document.querySelector('#play-dialog'); + const host=document.createElement('dune-shared-header');host.hidden=true; + const shadow=host.attachShadow({mode:'open'}); + const from=location.hostname==='wiki.dunerealms.com'?'':root; + const load=(path)=>{const link=document.createElement('link');link.rel='stylesheet';link.href=from+path;shadow.append(link);return new Promise(resolve=>{link.onload=()=>resolve(true);link.onerror=()=>resolve(false);});}; + const loaded=[load('/preview/portal.css'),load('/preview/sections.css'),load('/realm-design.css?v=shared-homepage-header-1')]; + const holder=document.createElement('template');holder.innerHTML=template;shadow.append(holder.content); + const nav=shadow.querySelector('#portal-navigation'),toggle=shadow.querySelector('.menu-toggle'),actions=shadow.querySelector('.nav-actions'); + // Reuse the original homepage structure, maintaining all PR602 destinations in the matching menu groups. + const addLink=(box,label,href)=>{const a=document.createElement('a');a.href=href;a.textContent=label;box.append(a);}; + for(const group of nav.querySelectorAll('details')){ + const label=group.querySelector('summary').childNodes[0].textContent.trim(); + const box=group.querySelector('.dropdown'); + for(const [text,href] of groups[label]||[])if(![...box.querySelectorAll('a')].some(a=>a.href===href))addLink(box,text,href); + } + // Keep the actual account control in its homepage position; its menu preserves the existing shared account routes. + const account=actions.querySelector('.account-link'),accountGroup=document.createElement('details');accountGroup.className='shared-account-group'; + const summary=document.createElement('summary');summary.className=account.className;summary.append(...account.childNodes); + const accountBox=document.createElement('div');accountBox.className='dropdown';for(const [label,href] of groups['My Account']||[])addLink(accountBox,label,href); + accountGroup.append(summary,accountBox);account.replaceWith(accountGroup); + const staff=actions.querySelector('[data-staff-access]'); + const oldStaff=old?.querySelector('[data-staff-access]')||bar?.querySelector('[data-staff-access]'); + if(oldStaff){staff.hidden=oldStaff.hidden;const mirror=new MutationObserver(()=>{staff.hidden=oldStaff.hidden;});mirror.observe(oldStaff,{attributes:true,attributeFilter:['hidden']});setTimeout(()=>mirror.disconnect(),10000);} + const welcome=location.hostname==='cp.dunerealms.com'?'/api/welcome':'https://cp.dunerealms.com/api/welcome'; + fetch(welcome,{credentials:'include',cache:'no-store',signal:AbortSignal.timeout(6000)}).then(r=>r.ok?r.json():null).then(context=>{if(context)staff.hidden=context.staffAccess!==true;}).catch(()=>{}); + const play=actions.querySelector('[data-play]');play.addEventListener('click',()=>{close();const dialog=document.querySelector('#play-dialog');if(home&&dialog?.showModal)dialog.showModal();else location.href=root+'/install.html';}); + const menus=[...shadow.querySelectorAll('details')]; + function close(){for(const menu of menus)menu.open=false;nav.classList.remove('open');toggle.setAttribute('aria-expanded','false');} + toggle.addEventListener('click',()=>{const open=toggle.getAttribute('aria-expanded')!=='true';nav.classList.toggle('open',open);toggle.setAttribute('aria-expanded',String(open));}); + for(const menu of menus)menu.addEventListener('toggle',()=>{if(menu.open)for(const other of menus)if(other!==menu)other.open=false;}); + document.addEventListener('click',e=>{if(!e.composedPath().includes(host))close();}); + document.addEventListener('keydown',e=>{if(e.key==='Escape'){const active=menus.find(m=>m.open);close();active?.querySelector('summary').focus();}}); + for(const a of shadow.querySelectorAll('a'))a.addEventListener('click',close); + const here=new URL(location.href); + const active=home?'Home':here.hostname==='forums.dunerealms.com'||/\/(discord|staff|community-records|news)/.test(here.pathname)?'Community':here.hostname==='support.dunerealms.com'||here.hostname==='wiki.dunerealms.com'||/\/manual|\/install/.test(here.pathname)?'Discover':here.hostname==='shop.dunerealms.com'||/\/exchange|\/kits/.test(here.pathname)?'Trade':/\/realm-hub/.test(here.pathname)?'The realm':null; + const homeLink=nav.querySelector('.nav-home');if(!home)homeLink.removeAttribute('aria-current'); + for(const item of nav.children){if(item.textContent.trim().startsWith(active||'\0')){const current=item.querySelector('summary')||item;current.setAttribute('aria-current','page');current.classList.add('shared-current');}} + // Managed badges remain in shared header links only; the same endpoint remains authoritative. + for(const badge of old?.querySelectorAll('.dune-new-overlay')||[]){const source=badge.closest('a');const target=[...shadow.querySelectorAll('.dropdown a')].find(a=>a.href===source?.href);if(target){const mark=document.createElement('span');mark.className='shared-menu-badge';mark.textContent=badge.textContent;target.append(mark);}} + const badges=location.hostname==='cp.dunerealms.com'?'/api/menu-badges':'https://cp.dunerealms.com/api/menu-badges'; + fetch(badges,{cache:'no-store'}).then(r=>r.ok?r.json():null).then(data=>{for(const a of shadow.querySelectorAll('.dropdown a')){const item=data?.items?.find(x=>x.href===a.href);if(['NEW','UPDATE'].includes(item?.badge)){const badge=a.querySelector('.shared-menu-badge')||document.createElement('span');badge.className='shared-menu-badge';badge.textContent=item.badge;if(!badge.parentNode)a.append(badge);}}}).catch(()=>{}); + (old||utility).before(host); + Promise.all(loaded).then(results=>{ + if(results.some(x=>!x)){host.remove();window.__duneHomepageHeaderMounted=false;return;} + if(old){old.remove();if(utility?.classList.contains('utility'))utility.remove();if(bar?.classList.contains('nav-bar'))bar.remove();} + else{utility.remove();original.remove();bar.remove();} + host.hidden=false; + }); +} +export function sharedHomepageHeaderFallback(html=readFileSync(new URL('../web/index.html',import.meta.url),'utf8')){ + const template=homepageHeaderTemplate(html).replace('
','
').replace('
','
'); + return '
'+template+'
'; +} +export function sharedHomepageHeaderScript(html=readFileSync(new URL('../web/index.html',import.meta.url),'utf8')){ + return '\n;('+mountSharedHomepageHeader.toString()+')('+JSON.stringify(homepageHeaderTemplate(html))+','+JSON.stringify(MAIN_MENU_GROUPS)+','+JSON.stringify(root)+');\n'; +} diff --git a/website/scripts/mybb-presentation.css b/website/scripts/mybb-presentation.css new file mode 100644 index 00000000..87d704cf --- /dev/null +++ b/website/scripts/mybb-presentation.css @@ -0,0 +1,45 @@ +/* MyBB's native content; keep navigation, permissions and forum-state classes intact. */ +html body:is(.dune-forum,.dr-native-boards){background:#071b16!important;color:#f4e8ca!important;font:16px/1.65 'DM Sans',Arial,sans-serif!important} +html body:is(.dune-forum,.dr-native-boards) :is(#container,#content,.wrapper){box-sizing:border-box} +html body:is(.dune-forum,.dr-native-boards) #container{width:min(1280px,calc(100% - 48px))!important;max-width:1280px!important;margin-inline:auto!important;border:0!important;background:transparent!important} +html body:is(.dune-forum,.dr-native-boards) #container>.wrapper, +html body:is(.dune-forum,.dr-native-boards) #content>.wrapper{width:100%!important;max-width:none!important;margin:0!important} +html body:is(.dune-forum,.dr-native-boards) #content{padding:0!important;margin:0 auto!important;max-width:none!important;background:transparent!important} +html body:is(.dune-forum,.dr-native-boards) #content>.navigation{margin:4px 0 12px!important;min-height:0!important;color:#b5c4b8!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-category{margin:12px 0 20px!important;border:1px solid #8f773e!important;border-radius:6px!important;background:#102c24!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-heading{padding:13px 18px!important;background:linear-gradient(105deg,#234536,#15342a)!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-heading p{margin:0 0 3px!important;font:10px/1.4 'DM Sans',Arial,sans-serif!important;letter-spacing:.12em} +html body:is(.dune-forum,.dr-native-boards) .dune-board-heading h2{margin:0!important;font:600 22px/1.25 'Cinzel',Georgia,serif!important;color:#f0d89b!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-panels{gap:12px!important;padding:12px!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-panel{border:1px solid #79643b!important;border-radius:5px!important;background:#102c24!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-panel-title{padding:10px 14px!important;gap:10px!important;background:#1a3b2e!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-panel-title img{width:38px!important;height:38px!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-panel-title h3{margin:0!important;font:600 18px/1.3 'Cinzel',Georgia,serif!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-panel-title p{margin:3px 0 0!important;font:13px/1.4 'DM Sans',Arial,sans-serif!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums th{padding:9px 12px!important;background:#204233!important;color:#f0d89b!important;font-size:12px!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums td{padding:9px 12px!important;border-color:#79643b!important;font-size:14px!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums td:first-child{width:46px!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums .smalltext{font-size:12px!important;line-height:1.45!important;color:#b5c4b8!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums :is(.trow1,.trow2){background:#102c24!important;color:#f4e8ca!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums tr:nth-child(even) td{background:#15362a!important} +html body:is(.dune-forum,.dr-native-boards) .dune-board-forums tr:hover td{background:#1a3b2e!important} +html body:is(.dune-forum,.dr-native-boards) :is(.thead,.tcat,.tfoot,.pagination,.popup_menu,.popup_item_container,.modcp_nav_item,.usercp_nav_item){background-color:#163329!important;border-color:#79643b!important;color:#f0d89b!important;text-shadow:none!important} +html body:is(.dune-forum,.dr-native-boards) :is(.thead,.tcat,.tfoot){background-image:none!important} +html body:is(.dune-forum,.dr-native-boards) :is(.trow1,.trow2,.trow_shaded,.post,.post_content,.post_body,.quote_body,.code_body,.editor,.sceditor-container,.sceditor-toolbar,.sceditor-group,.pm_alert,.forumdisplay_regular,.forumdisplay_sticky){background-color:#102c24!important;color:#f4e8ca!important;border-color:#79643b!important} +html body:is(.dune-forum,.dr-native-boards) :is(.post_author,.post_controls,.post_head,.quote_header,.code_header){background-color:#1a3b2e!important;color:#f4e8ca!important;border-color:#8f773e!important} +html body:is(.dune-forum,.dr-native-boards) :is(input.textbox,textarea,select,.sceditor-container textarea){background:#0a211b!important;color:#f4e8ca!important;border:1px solid #8f773e!important;border-radius:4px!important} +html body:is(.dune-forum,.dr-native-boards) :is(input.button,button.button,a.button){background:linear-gradient(135deg,#f8da8b,#dcb55a 55%,#b28633)!important;color:#242211!important;border:1px solid #c9a85a!important;border-radius:4px!important;font-family:'DM Sans',Arial,sans-serif!important;font-weight:700!important} +html body:is(.dune-forum,.dr-native-boards) :is(.pagination a,.pagination_current,.postbit_buttons a,.popup_item){border-color:#8f773e!important} +html body:is(.dune-forum,.dr-native-boards) :is(.forum_status,.subforumicon){background-size:contain!important;background-position:center!important;background-repeat:no-repeat!important;background-color:transparent!important} +html body:is(.dune-forum,.dr-native-boards) .forum_status{display:inline-block!important;width:30px!important;height:30px!important;vertical-align:middle!important} +html body:is(.dune-forum,.dr-native-boards) .subforumicon{width:16px!important;height:16px!important} +html body:is(.dune-forum,.dr-native-boards) :is(.forum_on,.subforum_minion){background-image:url('https://www.dunerealms.com/assets/forum-status-new.svg')!important} +html body:is(.dune-forum,.dr-native-boards) :is(.forum_off,.subforum_minioff){background-image:url('https://www.dunerealms.com/assets/forum-status-read.svg')!important} +html body:is(.dune-forum,.dr-native-boards) :is(.forum_offclose,.subforum_minioffclose){background-image:url('https://www.dunerealms.com/assets/forum-status-locked.svg')!important} +html body:is(.dune-forum,.dr-native-boards) :is(.forum_offlink,.subforum_miniofflink){background-image:url('https://www.dunerealms.com/assets/forum-status-link.svg')!important} +html body:is(.dune-forum,.dr-native-boards) #footer :is(.upper,.lower){background:#102c24!important;color:#b5c4b8!important;border-color:#8f773e!important} +@media(max-width:760px){ + html body:is(.dune-forum,.dr-native-boards) #container{width:calc(100% - 28px)!important;min-width:0!important} + html body:is(.dune-forum,.dr-native-boards) .dune-board-panels{padding:8px!important;gap:8px!important} + html body:is(.dune-forum,.dr-native-boards) .dune-board-forums td{padding:7px 5px!important;font-size:12px!important} +} diff --git a/website/scripts/osticket-presentation.css b/website/scripts/osticket-presentation.css new file mode 100644 index 00000000..80d9d947 --- /dev/null +++ b/website/scripts/osticket-presentation.css @@ -0,0 +1,60 @@ +/* Native osTicket presentation only. The existing ticket controls, forms, + thread markup, permissions and service navigation remain owned by osTicket. */ +html body:is(.dune-support,.dr-native-support){ + color-scheme:dark;background:#071b16!important;color:#f4e8ca!important; + font:16px/1.65 'DM Sans',Arial,sans-serif!important; +} +html body:is(.dune-support,.dr-native-support) :is(#container,#pjax-container,#content,.content,#ticket_container,#landing_page){ + background-color:#0f2921!important;color:#f4e8ca!important;border-color:#79613b!important; +} +html body:is(.dune-support,.dr-native-support) :is(h1,h2,h3,h4,.form-header,.form_table th){ + font-family:'Cinzel',Georgia,serif!important;color:#f4e8ca!important;text-shadow:none!important; +} +html body:is(.dune-support,.dr-native-support) :is(h1,h2){font-weight:600!important} +html body:is(.dune-support,.dr-native-support) :is(.dune-support-workspace-hero,.dune-support-card,.search.well,.ticket-info,.ticket_info,.infoTable,.thread-entry,.thread-entry-body,.thread-body,.tab_content,.panel,.card,.well,fieldset){ + background-color:#102d24!important;border-color:#8f773e!important;border-radius:6px!important;color:#f4e8ca!important; +} +html body:is(.dune-support,.dr-native-support) :is(.dune-support-workspace-hero,.dune-support-card){border:1px solid #8f773e!important;box-shadow:0 8px 20px #0002!important} +html body:is(.dune-support,.dr-native-support) .dune-support-workspace-hero h1{font-size:clamp(26px,3vw,44px)!important} +html body:is(.dune-support,.dr-native-support) :is(#nav,#sub_nav,.sub_nav,.tabs,.nav-tabs,.dune-support-submenu,.sticky.bar,.queue-actions,.ticket-actions){ + background:#102d24!important;border-color:#8f773e!important;color:#f4e8ca!important;box-shadow:none!important; +} +html body:is(.dune-support,.dr-native-support) :is(#nav,#sub_nav,.sub_nav,.tabs,.nav-tabs,.dune-support-submenu) a{color:#f0d89b!important;text-shadow:none!important} +html body:is(.dune-support,.dr-native-support) :is(#nav,#sub_nav,.sub_nav,.tabs,.nav-tabs,.dune-support-submenu) :is(a.active,[aria-current=page],.active>a,.selected>a){ + background:#234537!important;border-color:#d3ae5c!important;color:#fff1c8!important; +} +html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue,table.form_table,table.two-column,table.custom-data,.infoTable){ + background:#102c24!important;color:#f4e8ca!important;border-color:#8f773e!important; +} +html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue,table.form_table,table.two-column,table.custom-data,.infoTable) :is(th,thead td){ + background:#204233!important;color:#f0d89b!important;border-color:#79643b!important;text-shadow:none!important; +} +html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue) tbody tr{background:#102c24!important;color:#f4e8ca!important} +html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue) tbody tr:nth-child(even){background:#15362a!important} +html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue) tbody tr:hover{background:#234537!important} +html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue,table.form_table,table.two-column,table.custom-data,.infoTable) td{ + border-color:#79643b!important;color:inherit!important;background-color:transparent!important; +} +html body:is(.dune-support,.dr-native-support) :is(#ticketForm,#reply,#response,#ticketSearchForm,.form_table) :is(label,.required,.form-desc,.help-block,.instructions){color:#d5dfcf!important} +html body:is(.dune-support,.dr-native-support) :is(input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]):not([type=reset]):not([type=hidden]),textarea,select,.select2-selection,.select2-choice,.select2-choices,.redactor-editor,.redactor-box,.redactor-statusbar){ + background:#0a211b!important;color:#f4e8ca!important;border-color:#8f773e!important;border-radius:4px!important;box-shadow:none!important; +} +html body:is(.dune-support,.dr-native-support) :is(input,textarea)::placeholder{color:#b5c4b8!important} +html body:is(.dune-support,.dr-native-support) :is(.redactor-toolbar,.thread-entry .header,.thread-entry .header .title,.thread-entry .avatar,.form-header,.section-break){ + background-color:#1a3b2e!important;color:#f4e8ca!important;border-color:#8f773e!important; +} +html body:is(.dune-support,.dr-native-support) :is(.select2-dropdown,.select2-results,.dropdown-menu,.typeahead,.ui-menu,.ui-dialog,.ui-dialog-content,.dialog,.modal,.modal-content,.popup){ + background:#112b24!important;color:#f4e8ca!important;border-color:#8f773e!important; +} +html body:is(.dune-support,.dr-native-support) :is(.ui-dialog-titlebar,.modal-header,.dialog .header){background:#204233!important;color:#f0d89b!important;border-color:#8f773e!important} +html body:is(.dune-support,.dr-native-support) :is(.select2-results__option--highlighted,.ui-state-focus,.ui-menu-item:hover,.dropdown-menu a:hover){background:#234537!important;color:#fff1c8!important} +html body:is(.dune-support,.dr-native-support) :is(.button,.btn,input[type=submit],input[type=button],button.primary){ + color:#242211!important;background:linear-gradient(135deg,#f8da8b,#dcb55a 55%,#b28633)!important;border:1px solid #c9a85a!important;border-radius:4px!important;font-family:'DM Sans',Arial,sans-serif!important;font-weight:700!important;text-shadow:none!important; +} +html body:is(.dune-support,.dr-native-support) :is(a,button,input,select,textarea):focus-visible{outline:2px solid #f5d48b!important;outline-offset:3px} +html body:is(.dune-support,.dr-native-support) :is(.faded,.muted,.help-block,.instructions,.form-desc){color:#b5c4b8!important} +html body:is(.dune-support,.dr-native-support) :is(.ticket-info,.ticket_info,.thread-entry,.form_table) a:not(.button):not(.btn){color:#f0d89b!important} +@media(max-width:700px){ + html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue){font-size:13px!important} + html body:is(.dune-support,.dr-native-support) :is(#ticketTable,table.list,table.listings,table.queue) :is(th,td){padding:9px!important} +} diff --git a/website/scripts/portal-navigation.mjs b/website/scripts/portal-navigation.mjs index 13817302..ed713e9a 100644 --- a/website/scripts/portal-navigation.mjs +++ b/website/scripts/portal-navigation.mjs @@ -1,4 +1,5 @@ import {applySharedFooter} from './site-chrome.mjs'; +import {sharedHomepageHeaderFallback} from './homepage-header.mjs'; import{MAIN_MENU,MAIN_MENU_GROUPS}from'./main-menu.mjs'; export const PORTAL_LINKS=MAIN_MENU; const menuLink=([name,url,icon,children])=>children?`
${name}
${children.map(menuLink).join('')}
`:`${name}`; @@ -18,7 +19,7 @@ body>header>.menu-toggle{display:none!important;box-shadow:none;border:1px solid `; export function oldUpdatePortalNavigation(html){let updated=html.replace(/
assertSharedChrome(next.replace('{ const memorial='',legal=''; diff --git a/website/tests/template-fix-6000.test.mjs b/website/tests/template-fix-6000.test.mjs new file mode 100644 index 00000000..3fad7147 --- /dev/null +++ b/website/tests/template-fix-6000.test.mjs @@ -0,0 +1,46 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs'; +import {sharedHomepageHeaderFallback,sharedHomepageHeaderScript,homepageHeaderTemplate} from '../scripts/homepage-header.mjs'; +import {SHARED_HEADER} from '../scripts/portal-navigation.mjs'; +import {MAIN_MENU_GROUPS} from '../scripts/main-menu.mjs'; +const read=path=>readFileSync(new URL('../'+path,import.meta.url),'utf8'); +test('Template Fix 6000 generates one shared header from the original homepage and retains PR602 menu destinations',()=>{ + const original=read('web/index.html'),runtime=sharedHomepageHeaderScript(original); + assert.equal(SHARED_HEADER,sharedHomepageHeaderFallback(original)); + assert(runtime.includes(JSON.stringify(homepageHeaderTemplate(original)))); + assert(runtime.includes(JSON.stringify(MAIN_MENU_GROUPS))); + assert.doesNotThrow(()=>new Function(runtime)); + assert.match(runtime,/window\.top!==window\.self/); + assert.match(runtime,/context\.staffAccess!==true/); + assert.match(runtime,/dialog\.showModal\(\)/); +}); +test('native support keeps the authored workspace intro and native themes do not target unrelated sites',()=>{ + assert.match(read('web/realm-design.js'),/\.arrival-grid,\.dune-support-workspace-hero/); + const support=read('scripts/osticket-presentation.css'); + for(const selector of ['#ticketTable','#ticketForm','.thread-entry','.redactor-editor','.ui-dialog','.queue'])assert(support.includes(selector)); + assert.match(support,/body:is\(\.dune-support,\.dr-native-support\)/); + assert.doesNotMatch(support,/display:\s*none/); +}); +test('native forum status artwork maps every actual MyBB state and board shortcuts are only a no-row fallback',()=>{ + const css=read('scripts/mybb-presentation.css'),sections=read('integrations/mybb/inc/plugins/dune_sections.php'); + for(const [state,icon]of [['forum_on','new'],['forum_off','read'],['forum_offclose','locked'],['forum_offlink','link']]){ + assert(css.includes('.'+state)); + assert(css.includes('forum-status-'+icon+'.svg')); + assert.match(read('web/assets/forum-status-'+icon+'.svg'),/^')); + assert.match(sections,/if\(\$rows&&!empty\(\$rows\['forum_list'\]\)\)/); + assert.match(sections,/else if\(\$children\).*dune_sections_links\(\$children\)/); + assert.match(sections,/forum_permissions/); + assert.match(sections,/forum_password_validated/); +}); +test('native publisher and website build publish the same header and both presentation styles',()=>{ + const build=read('scripts/build.mjs'),pub=read('ops/publish-realm-design.py'); + for(const name of ['homepage-header.css','osticket-presentation.css','mybb-presentation.css']){ + assert(build.includes(name));assert(pub.includes(name)); + } + assert(build.includes('sharedHomepageHeaderScript()')); + assert(pub.includes('data-shared-header-source="homepage"')); + assert(pub.includes('mybb/inc/plugins/dune_sections.php')); +}); diff --git a/website/web/assets/forum-status-link.svg b/website/web/assets/forum-status-link.svg new file mode 100644 index 00000000..3125edb2 --- /dev/null +++ b/website/web/assets/forum-status-link.svg @@ -0,0 +1 @@ + diff --git a/website/web/assets/forum-status-locked.svg b/website/web/assets/forum-status-locked.svg new file mode 100644 index 00000000..68cd3bcd --- /dev/null +++ b/website/web/assets/forum-status-locked.svg @@ -0,0 +1 @@ + diff --git a/website/web/assets/forum-status-new.svg b/website/web/assets/forum-status-new.svg new file mode 100644 index 00000000..2275b3b9 --- /dev/null +++ b/website/web/assets/forum-status-new.svg @@ -0,0 +1 @@ + diff --git a/website/web/assets/forum-status-read.svg b/website/web/assets/forum-status-read.svg new file mode 100644 index 00000000..2c2fbff6 --- /dev/null +++ b/website/web/assets/forum-status-read.svg @@ -0,0 +1 @@ + diff --git a/website/web/realm-design.js b/website/web/realm-design.js index bbb12871..796602e8 100644 --- a/website/web/realm-design.js +++ b/website/web/realm-design.js @@ -32,13 +32,14 @@ } const memorial=header?.querySelector('.dune-memorial'),footer=document.querySelector('body>footer,.dune-shared-footer');if(memorial&&footer)footer.append(memorial); // The host page owns one banner; embedded services keep their content width. - if(!embedded&&!workspace&&!document.querySelector('.dr-page-banner,.section-banner')&&header){ + if(!embedded&&!workspace&&!document.querySelector('.arrival-grid,.dune-support-workspace-hero')&&!document.querySelector('.dr-page-banner,.section-banner')&&header){ const main=document.querySelector('main,#content,#main-content,.main-content,#container>#content'); const title=document.querySelector('main h1,.main-content h1,#content h1'),label=title?.textContent.trim()||document.title.replace(/\s*[|—·]\s*DuneRealms.*$/i,'').trim(); if(main&&(title||nativeHost)){const banner=document.createElement('section');banner.className='dr-page-banner';const icon=document.createElement('img');icon.src=root+'/assets/'+({boards:'nav-boards-v2.webp',support:'nav-support-v2.webp',shop:'nav-shop-v1.webp',wiki:'nav-manual-v2.webp',git:'nav-manual-v2.webp',mail:'nav-support-v2.webp'})[nativeHost||'wiki'];icon.alt='';icon.width=80;icon.height=92;const content=document.createElement('div');const crumbs=document.createElement('div');crumbs.className='dr-breadcrumb';const home=document.createElement('a');home.href=root+'/';home.textContent='DuneRealms';crumbs.append(home,document.createTextNode(' / '+label));const heading=document.createElement('h1');heading.textContent=label;content.append(crumbs,heading);banner.append(icon,content);main.before(banner);main.classList.add('dr-page-content');document.body.classList.add('dr-interior');} } if(nativeHost==='wiki'&&!embedded){const main=document.querySelector('.mw-body,#content,.main-content');if(main&&!document.querySelector('.dr-wiki-placeholder')){const notice=document.createElement('section');notice.className='dr-wiki-placeholder';const heading=document.createElement('h2');heading.textContent='The Dunopedia is being updated';const copy=document.createElement('p');copy.textContent='The existing wiki is an archive and may describe outdated features. Updated guides will be published here.';const link=document.createElement('a');link.href=root+'/manual.html';link.textContent='Open the player field manual →';notice.append(heading,copy,link);main.prepend(notice);}} function polishContent(){ + if(nativeHost==='boards'){const nav=document.querySelector('#content>.navigation');if(nav&&document.querySelector('.dune-board-category')&&nav.textContent.trim()==='DuneRealms Forums'&&nav.querySelectorAll('a').length<=1)nav.hidden=true;for(const status of document.querySelectorAll('.forum_status[title],.subforumicon[title]')){const label=status.title;if(status.getAttribute('aria-label')!==label)status.setAttribute('aria-label',label);if(!status.classList.contains('ajax_mark_read'))status.setAttribute('role','img');}} const account=header?.querySelector('nav [data-dune-nav-group="My Account"]');if(account){account.classList.add('dr-account-menu');header.querySelector('.dr-header-bar>.dr-nav-account:not(.dr-staff-link)')?.remove();} if(document.querySelector('.dr-page-banner'))for(const h of document.querySelectorAll('main h1'))if(!h.classList.contains('dr-content-title')){h.classList.add('dr-content-title');h.setAttribute('role','heading');h.setAttribute('aria-level','2');} // Keep calendar, editor and data-grid table structures under their owners.