wide-members.js 1.2 KB

1
  1. (()=>{if(new URLSearchParams(location.search).get('projection')!=='home')return;document.documentElement.classList.add('md-project');const sub=location.pathname.includes('/member-reports/'),app=location.pathname.endsWith('/app.html');function carry(){document.querySelectorAll('a[href]').forEach(a=>{let raw=a.getAttribute('href');if(!/^(?:\.\.\/)?(?:app|family-pedigree|member-reports\/index)\.html(?:#.*)?$/.test(raw)||a.closest('.project-actions,.md-aux-tools'))return;let u=new URL(raw,location.href);u.searchParams.set('projection','home');a.href=u.href})}document.addEventListener('DOMContentLoaded',()=>{if(!app){const box=document.createElement('nav');box.className='md-aux-tools';const home=sub?'../app.html':'app.html';box.innerHTML='<a href="'+home+'?projection=home#c1">会员首页</a><button type="button">全屏切换</button><a href="'+home+'#c1">退出演示</a>';box.querySelector('button').onclick=()=>document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen?.();(document.querySelector('main,.page')||document.body).prepend(box)}carry();new MutationObserver(carry).observe(document.body,{childList:true,subtree:true})})})();