feat(guest): add 'back' button on post & refresh when post is made.
This commit is contained in:
parent
e9379d1e23
commit
25f9cd96ff
1 changed files with 23 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
<div id="page-container">
|
||||
<div id="header-container">
|
||||
<h1 id="title">iwakura.rip</h1>
|
||||
<a class="link" onclick="show_message_poster()" style="margin-bottom: 10px;"> [ post message ] </a>
|
||||
<h1 id="title"><a href="/">iwakura.rip</a></h1>
|
||||
<a class="link" id="msg-post" onclick="show_message_poster()" style="margin-bottom: 10px;"> [ post message ] </a>
|
||||
</div>
|
||||
<div id="entries-container">
|
||||
{% for message in messages %}
|
||||
|
@ -27,9 +27,19 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let show_post_message = false;
|
||||
let show_message_poster = () => {
|
||||
document.getElementById("entries-container").style.display = "none";
|
||||
document.getElementById("post-container").style.display = "flex";
|
||||
if (!show_post_message) {
|
||||
show_post_message = !show_post_message
|
||||
document.getElementById("entries-container").style.display = "none";
|
||||
document.getElementById("post-container").style.display = "flex";
|
||||
document.getElementById("msg-post").innerText = " [ back ] ";
|
||||
return
|
||||
}
|
||||
document.getElementById("msg-post").innerText = " [ post message ] "
|
||||
show_post_message = !show_post_message
|
||||
document.getElementById("entries-container").style.display = "flex";
|
||||
document.getElementById("post-container").style.display = "none";
|
||||
}
|
||||
let send_msg = async () => {
|
||||
fetch("/post_message", {
|
||||
|
@ -38,10 +48,18 @@
|
|||
body: document.getElementById("msg-box").value,
|
||||
name: document.getElementById("name-box").value
|
||||
}),
|
||||
}).then(x => {
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
:root {
|
||||
--term-color: #4AF626;
|
||||
--title-gap: 0px;
|
||||
|
@ -92,6 +110,7 @@ label {
|
|||
float: left;
|
||||
}
|
||||
.link {
|
||||
cursor: default;
|
||||
align-items: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
|
Loading…
Reference in a new issue