-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
30 lines (30 loc) · 989 Bytes
/
main.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
/*
This JS will run on every single page of the website
*/
const wideRoot = document.getElementById("wide");
const narrowRoot = document.getElementById("narrow");
function resize() {
if (window.outerWidth <= 756) {
narrowRoot.removeAttribute("style");
wideRoot.setAttribute("style", "display: none;");
} else {
wideRoot.removeAttribute("style");
narrowRoot.setAttribute("style", "display: none;");
}
}
resize();
let anchors = document.getElementsByClassName("link");
for (let a = 0; a < anchors.length; ++a) {
if (anchors[a].getAttribute("href") === "") {
anchors[a].setAttribute("style", "text-decoration: underline;");
}
}
setInterval(resize, 1);
const links = document.getElementById("links-narrow");
document.getElementById("narrow").addEventListener("click", () => {
if (links.getAttribute("style")) {
links.removeAttribute("style");
} else {
links.setAttribute("style", "display: none;");
}
});