-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
65 lines (55 loc) · 2.43 KB
/
script.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
document.addEventListener('DOMContentLoaded', function() {
const header = document.getElementById('main-header');
header.innerHTML = createNavBar() + createHeader('The <strong>Evangelista</strong> Lab');
});
function createHeader(title) {
return `<h1>The <strong>Evangelista</strong> Lab</h1>`;
}
function createNavBar() {
return `
<nav id="main-nav">
<a href="index.html">Home</a>
<a href="people.html">People</a>
<a href="research.html">Research</a>
<a href="talks.html">Talks</a>
<a href="publications.html">Publications</a>
<a href="contact.html">Contact</a>
</nav>
`;
}
document.addEventListener("DOMContentLoaded", function() {
var head = document.head;
// Create meta tags
var metaCharset = document.createElement("meta");
metaCharset.setAttribute("charset", "UTF-8");
var metaViewport = document.createElement("meta");
metaViewport.setAttribute("name", "viewport");
metaViewport.setAttribute("content", "width=device-width, initial-scale=1.0");
// Create title tag
var title = document.createElement("title");
title.textContent = "Evangelista Lab";
// Create stylesheet link
var styles = document.createElement("link");
styles.setAttribute("rel", "stylesheet");
styles.setAttribute("href", "styles.css");
// Create preconnect links
var preconnect1 = document.createElement("link");
preconnect1.setAttribute("rel", "preconnect");
preconnect1.setAttribute("href", "https://fonts.googleapis.com");
var preconnect2 = document.createElement("link");
preconnect2.setAttribute("rel", "preconnect");
preconnect2.setAttribute("href", "https://fonts.gstatic.com");
preconnect2.setAttribute("crossorigin", "");
// Create font stylesheet link
var fontLink = document.createElement("link");
fontLink.setAttribute("href", "https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap");
fontLink.setAttribute("rel", "stylesheet");
// Append elements to head
head.appendChild(metaCharset);
head.appendChild(metaViewport);
head.appendChild(title);
head.appendChild(styles);
head.appendChild(preconnect1);
head.appendChild(preconnect2);
head.appendChild(fontLink);
});