forked from ASSETS-Conference/assets2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.js
42 lines (38 loc) · 1.29 KB
/
setup.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
;(function () {
const script = document.createElement('script')
script.src = 'https://cloud.umami.is/script.js'
script.defer = true
script.setAttribute('data-website-id', 'e2f681f9-0ef5-4e7c-98b9-e3f2316e9125')
document.head.appendChild(script) // Append the script to the head
})()
fetch('footer.html')
.then((response) => response.text())
.then((html) => {
document.getElementById('footer-container').innerHTML = html
})
fetch('menu.html')
.then((response) => response.text())
.then((html) => {
const menuEl = document.getElementById('nav-container')
const activePage = menuEl.getAttribute('data-active')
menuEl.innerHTML = html
if (activePage) {
const activeMenuItem = menuEl.querySelector(`[data-page="${activePage}"]`)
if (activeMenuItem) {
activeMenuItem.parentElement.classList.add('selected-link')
}
}
const script = document.createElement('script')
script.src = 'menu.js'
document.body.appendChild(script)
})
/*
// Add small caps to all-caps words
document
.querySelectorAll('div.text-block p, div.text-block li, .grid-item p')
.forEach(function (element) {
element.innerHTML = element.innerHTML.replace(/\b([A-Z]{2,})\b/g, function (match) {
return `<span class="small-caps">${match}</span>`
})
})
*/