-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (24 loc) · 995 Bytes
/
script.js
File metadata and controls
26 lines (24 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import('/module.js').then(module => {
// Use functions/exports from the module
module.init?.();
}).catch(err => console.error('Failed to load module script', err));
window.addEventListener('DOMContentLoaded', () => {
const toggleBtn = document.querySelector('.header-section__toggle');
const navLinks = document.querySelector('.header-section__links');
toggleBtn?.addEventListener('click', () => navLinks?.classList.toggle('active'));
(async () => {
try {
const headHTML = document.head.innerHTML;
if (headHTML.includes('<!-- inject-universal-head -->')) {
const headres = await fetch('/head.html?cachebust=' + Date.now());
if (!headres.ok) throw new Error('Failed to load head.html');
const headContent = await headres.text();
document.head.innerHTML += headContent;
} else {
console.log('No universal head marker found.');
}
} catch (err) {
console.error('Head loading error:', err);
}
})();
});