summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/loadPage.ts20
-rw-r--r--js/setNavBarState.ts2
2 files changed, 11 insertions, 11 deletions
diff --git a/js/loadPage.ts b/js/loadPage.ts
index 72bb124..ebf1f62 100644
--- a/js/loadPage.ts
+++ b/js/loadPage.ts
@@ -1,9 +1,9 @@
/// <reference path="initImages.ts" />
-async function loadPage(page: string) {
- console.log("loading page `" + page + "`")
+async function loadPage(name: string) {
+ console.log("loading page `" + name + "`")
- let url = `/html/${page}.html`;
+ let url = `/html/${name}.html`;
window.history.pushState("", "", url);
let response = await fetch(url);
@@ -17,16 +17,16 @@ async function loadPage(page: string) {
let parser = new DOMParser();
let dom = parser.parseFromString(markup, "text/html");
- let title = document.getElementById("title")!;
- let body = document.getElementById("body")!;
- let content = document.getElementById("content")!;
+ let title = document.getElementById("title")!;
+ let body = document.getElementById("body")!;
+ let page = document.getElementById("page")!;
- let new_title = dom.getElementById("title")!;
- let new_content = dom.getElementById("content")!;
+ let new_title = dom.getElementById("title")!;
+ let new_page = dom.getElementById("page")!;
title.replaceWith(new_title);
- body.setAttribute("data-page", page);
- content.replaceWith(new_content);
+ body.setAttribute("data-page", name);
+ page.replaceWith(new_page);
initImages();
}
diff --git a/js/setNavBarState.ts b/js/setNavBarState.ts
index 04058f7..cfcc509 100644
--- a/js/setNavBarState.ts
+++ b/js/setNavBarState.ts
@@ -7,7 +7,7 @@ function setNavBarState(state: NavBarState) {
console.log("setting navigation bar to `" + NavBarState[state] + "`");
let nav_bar = document.getElementById("navBar")!;
- let hamburger = document.getElementById("hamburger")!
+ let hamburger = document.getElementById("hamburger")!;
nav_bar.setAttribute("data-state", NavBarState[state]);
hamburger.setAttribute("data-navBarState", NavBarState[state]);