diff options
Diffstat (limited to 'js/loadPage.ts')
-rw-r--r-- | js/loadPage.ts | 20 |
1 files changed, 10 insertions, 10 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(); } |