diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/index.html | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/templates/index.html b/templates/index.html index 3f94c89..df6d4c6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,8 +7,6 @@ {{macros::window(title="👤 Welcome to " ~ soaos ~ ".dev")}} <div> <div id="status"> -<h3>Latest Status</h3> -<div id="statuscafe" class="sunken-panel"><div id="statuscafe-username"></div><div id="statuscafe-content"></div></div><script src="https://status.cafe/current-status.js?name=soaos" defer></script> </div> <p> I'm an "artist" and professional software developer. In my free time I mostly work on eccentric software projects which you can read about here. @@ -42,4 +40,21 @@ I'm an "artist" and professional software developer. In my free time I mostly wo {{macros::endtreeview()}} {{macros::endwindow()}} +<script id="status-template" type="text/html"> +<h3>Latest Status</h3> +<div id="statuscafe" class="sunken-panel"><div id="statuscafe-username"></div><div id="statuscafe-content"></div></div> +</script> +<script> + document.getElementById("status").innerHTML = document.getElementById("status-template").innerHTML; + fetch("https://status.cafe/users/soaos/status.json") + .then( r => r.json() ) + .then( r => { + if (!r.content.length) { + document.getElementById("statuscafe-content").innerHTML = "No status yet." + return + } + document.getElementById("statuscafe-username").innerHTML = '<a href="https://status.cafe/users/soaos" target="_blank">' + r.author + '</a> ' + r.face + ' ' + r.timeAgo + document.getElementById("statuscafe-content").innerHTML = r.content + }) +</script> {% endblock content %} |
