/* ----------------------------------------- MBC CUSTOM JS - Header Include ----------------------------------------- */ // check for function isSkippedImports() { const metaTag = document.querySelector('meta[name="skip-template-imports"]'); return metaTag !== null && metaTag.getAttribute('content') === 'true'; } if (!isSkippedImports()) { // if not skipped, append CSS and JS to the head const head = document.head; // CSS files const cssFiles = [ `https://www.mbc.ca.gov/bundles/css` ]; cssFiles.forEach(href => { const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = href; head.appendChild(link); }); // JS files const jsFiles = [ 'https://www.mbc.ca.gov/bundles/libs', 'https://www.mbc.ca.gov/bundles/js' ]; jsFiles.forEach(src => { const script = document.createElement('script'); script.src = src; head.appendChild(script); }); } // create header element const mbcHeader = document.createElement('header'); mbcHeader.setAttribute('role', 'banner'); mbcHeader.id = 'header'; mbcHeader.className = 'global-header fixed hide-print'; // header content const mbcHeaderContent = `
Skip to Main Content
`; // create print header element const mbcPrintHeader = document.createElement('div'); mbcPrintHeader.style.display = "none"; mbcPrintHeader.className = 'container show-print'; // header content const mbcPrintHeaderContent = `
Medical Board of California Logo


`; // Insert print header insertHeaderInBody(mbcPrintHeader, mbcPrintHeaderContent); // Display current url and date in the print header document.getElementById('current-page-url').textContent = window.location.href; const currentDate = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); document.getElementById('current-date').textContent = currentDate; // insert default header insertHeaderInBody(mbcHeader, mbcHeaderContent); // insert mbcHeader into the TOP of the body function insertHeaderInBody(element, content) { const mbcBody = document.body; const mbcFirstChild = mbcBody.firstChild; // insert the code element.innerHTML = content; mbcBody.insertBefore(element, mbcFirstChild); }