quality of life improvements (both user and dev)

This commit is contained in:
2023-02-01 21:15:33 -06:00
parent b04dc0504f
commit 3474891c2c
5 changed files with 44 additions and 27 deletions

View File

@@ -89,8 +89,9 @@ function toggleMenu() {
}
const loc = "https://asimonson.com"
// const loc = 'http://127.0.0.1:5000'
async function goto(location) {
async function goto(location, push=true) {
let a = await fetch(loc + "/api/goto/" + location, {
credentials: "include",
method: "GET",
@@ -105,5 +106,12 @@ async function goto(location) {
eval(x.innerHTML);
});
document.querySelector("title").textContent = metadata['title'];
history.pushState(null, null, metadata['canonical']);
if(push){
history.pushState(null, null, metadata['canonical']);
}
}
function backButton() {
const location = window.location.pathname;
goto(location.substring(1), push=false); // remove slash, goto already does that
}