initial work on client-side templating

This commit is contained in:
knotteye
2020-10-14 00:03:45 -05:00
parent 99879fd91e
commit 57d0b0f856
3 changed files with 47 additions and 2 deletions

37
site/index.html Normal file
View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<head>
<script src="/nunjucks-slim.js"></script>
<script src="/templates.js"></script>
<script>
nunjucks.configure({ autoescape: true });
</script>
</head>
<body onload="render()">
<script>
function render(){
switch(window.location.pathname){
case "/about.html":
document.body.innerHTML = nunjucks.render('about.html');
break;
case "/tos.html":
document.body.innerHTML = nunjucks.render('tos.html');
break;
default:
document.body.innerHTML = nunjucks.render('404.njk');
}
}
function getContext(){
var conf = {
sitename: "",
domain: "",
email: "",
version: "",
registration: false
}
var info = new XMLHttpRequest();
info.onload = () => {
if(xhr.status === 200)
}
}
</script>
</body>