moved couldhave into METASP coming from hugo's metadata/index.js

also Escape goes one page back to the original page edit page tries to edit
This commit is contained in:
Marcell Mars 2021-04-15 00:55:21 +02:00
parent 129e2ba1c7
commit eb3e4b62d6

View file

@ -2,7 +2,7 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
let v = "loading..."; let v = "loading...";
let path = "loading..."; let path = "loading...";
var couldhave = [] let couldhave = []
function disableButtons() { function disableButtons() {
let tierbox = [...document.querySelector(".tierbox").children] let tierbox = [...document.querySelector(".tierbox").children]
@ -186,7 +186,7 @@
v = v.substring(1) v = v.substring(1)
} }
path = repo.path; path = repo.path;
couldhave = repo.couldhave; couldhave = METASP[Object.keys(repo.frontmatter).filter(t => t.startsWith("has_"))[0].split("has_")[1]].tiers
console.log(JSON.stringify(repo)) console.log(JSON.stringify(repo))
generateFrontMatter(repo.frontmatter, path, repo.relpermalink, document.location.protocol.substring(0,4)) generateFrontMatter(repo.frontmatter, path, repo.relpermalink, document.location.protocol.substring(0,4))
} }
@ -194,6 +194,12 @@
document.body.appendChild(el) document.body.appendChild(el)
} }
function keyUp(e) {
if (e.key == "Escape") {
window.history.back()
}
}
onMount(()=> { onMount(()=> {
dispatchHash() dispatchHash()
}) })
@ -201,7 +207,7 @@
$: hashChanged = ()=> dispatchHash(); $: hashChanged = ()=> dispatchHash();
</script> </script>
<svelte:window on:hashchange={hashChanged} /> <svelte:window on:hashchange={hashChanged} on:keyup={keyUp}/>
<main id="sandpoints"> <main id="sandpoints">
<form> <form>
<label for="content">Content:</label> <label for="content">Content:</label>