akf-forum/views/extra/footer.ejs

33 lines
927 B
Plaintext

<div class="footer">
<% if (user){ %>
<select id="theme_select">
<% for(const theme of dataset.themes){%>
<option value="<%= theme %>"><%= theme %> theme</option>
<% } %>
</select>
<script>
const theme_select = document.getElementById("theme_select");
theme_select.querySelector(`option[value=<%= user.theme.name %>]`).selected = true;
theme_select.addEventListener("change", async e => {
const name = e.target.value;
await fetch('/api/users/<%= user.id %>', {
method: 'PATCH',
body: JSON.stringify({
theme: {
name
}
}),
headers: {
"Content-Type": "application/json"
}
});
location.reload();
});
</script>
<% } %>
<a href="https://github.com/Akif9748/akf-forum" style="color: white;"> This website is powered by
<span style="color: #ffbf00;">akf-forum</span>
</a>
</div>