diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..35977fb --- /dev/null +++ b/footer.html @@ -0,0 +1,3 @@ + diff --git a/header.html b/header.html new file mode 100644 index 0000000..f8715eb --- /dev/null +++ b/header.html @@ -0,0 +1,39 @@ + diff --git a/index.html b/index.html index b345d15..d99190a 100644 --- a/index.html +++ b/index.html @@ -8,50 +8,7 @@ - - + @@ -94,10 +51,7 @@ - - + diff --git a/reporting.html b/reporting.html index 1f76a59..a0144b6 100644 --- a/reporting.html +++ b/reporting.html @@ -8,46 +8,7 @@ - - +
@@ -73,10 +34,7 @@
- - + diff --git a/signups.html b/signups.html index d11d23c..ca2560c 100644 --- a/signups.html +++ b/signups.html @@ -8,46 +8,7 @@ - - +
@@ -73,10 +34,7 @@
- - + diff --git a/src/main.js b/src/main.js index 8b13789..ee8be63 100644 --- a/src/main.js +++ b/src/main.js @@ -1 +1,21 @@ +function loadHTML(file, elementId) { + fetch(file) + .then(r => r.text()) + .then(html => { + document.getElementById(elementId).innerHTML = html; + if (elementId === 'header') highlightActiveNav(); + }) + .catch(err => console.error('Error loading:', file, err)); +} +function highlightActiveNav() { + const current = location.pathname.split('/').pop() || 'index.html'; + document.querySelectorAll('#header a[href]').forEach(link => { + if (link.getAttribute('href') === `/${current}`) { + link.classList.add('active'); + } + }); +} + +loadHTML('/header.html', 'header'); +loadHTML('/footer.html', 'footer'); diff --git a/stats.html b/stats.html index 1505fc6..bc70d86 100644 --- a/stats.html +++ b/stats.html @@ -8,46 +8,7 @@ - - +
@@ -72,10 +33,7 @@
- - +