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 - Fix footer, theme, category pages
- upload other photos, model for it - upload other photos, model for it
- category system bloat. - category system bloat.
- replace not found errors with no perm
- preview for send messages in markdown format. - preview for send messages in markdown format.
- Limits for thread title, message content, username, user about - Limits for thread title, message content, username, user about
- desp => description
## Major Version History ## Major Version History
- V4: Caching - V4: Caching

View file

@ -1,10 +1,24 @@
<div class="footer"> <div class="footer">
<select> <% if (user){ %>
<option value="default">Default theme</option> <a onclick="invert()" class="btn-primary" style="color:white;"><%=(user.theme === "default" ? "black" : "default" ) + " theme!" %></a>
<option value="black">Black theme</option> <script>
</select> 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 <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> <div>
<span style="color:white">Coders</span> <br> <span style="color:white">Coders</span> <br>

View file

@ -17,19 +17,6 @@
</div> </div>
</a> </a>
<a id="logout" href="/login" class="btn-primary">Logout</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 { %> <% } else { %>
<a id="login" href="/login" class="btn-primary">Login</a> <a id="login" href="/login" class="btn-primary">Login</a>