akf-forum/views/extra/footer.ejs

33 lines
927 B
Text
Raw Normal View History

<div class="footer">
2022-09-16 23:22:29 +03:00
<% if (user){ %>
2023-05-08 18:17:46 +03:00
<select id="theme_select">
<% for(const theme of dataset.themes){%>
<option value="<%= theme %>"><%= theme %> theme</option>
<% } %>
</select>
2022-09-16 23:22:29 +03:00
<script>
2023-05-08 18:17:46 +03:00
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;
2022-09-16 23:22:29 +03:00
await fetch('/api/users/<%= user.id %>', {
method: 'PATCH',
body: JSON.stringify({
2023-05-08 18:17:46 +03:00
theme: {
name
}
2022-09-16 23:22:29 +03:00
}),
headers: {
"Content-Type": "application/json"
}
});
2023-05-08 18:17:46 +03:00
location.reload();
});
2022-09-16 23:22:29 +03:00
</script>
<% } %>
<a href="https://github.com/Akif9748/akf-forum" style="color: white;"> This website is powered by
2023-05-08 18:17:46 +03:00
<span style="color: #ffbf00;">akf-forum</span>
</a>
</div>