Better location for theme replacer

This commit is contained in:
Akif9748 2022-09-16 23:22:29 +03:00
parent 109b83e7cd
commit 2064d0c0a6
3 changed files with 20 additions and 19 deletions

View File

@ -42,9 +42,9 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn
- Fix footer, theme, category pages
- upload other photos, model for it
- category system bloat.
- replace not found errors with no perm
- preview for send messages in markdown format.
- Limits for thread title, message content, username, user about
- desp => description
## Major Version History
- V4: Caching

View File

@ -1,10 +1,24 @@
<div class="footer">
<select>
<option value="default">Default theme</option>
<option value="black">Black theme</option>
</select>
<% if (user){ %>
<a onclick="invert()" class="btn-primary" style="color:white;"><%=(user.theme === "default" ? "black" : "default" ) + " theme!" %></a>
<script>
async function invert() {
await fetch('/api/users/<%= user.id %>', {
method: 'PATCH',
body: JSON.stringify({
theme: "<%= user.theme === `default` ? `black` : `default` %>"
}),
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>
<span style="color: #ffbf00;">akf-forum</span> </a>
<div>
<span style="color:white">Coders</span> <br>

View File

@ -17,19 +17,6 @@
</div>
</a>
<a id="logout" href="/login" class="btn-primary">Logout</a>
<a onclick="invert()" class="btn-outline-primary"><%=(user.theme === "default" ? "black" : "default" ) + " mode" %></a>
<script>
async function invert() {
await fetch('/api/users/<%= user.id %>', {
method: 'PATCH',
body: JSON.stringify({ theme: "<%=user.theme === `default` ? `black` : `default` %>" }),
headers: {
"Content-Type": "application/json"
}
});
location.reload()
}
</script>
<% } else { %>
<a id="login" href="/login" class="btn-primary">Login</a>