Better scroll and better category page

This commit is contained in:
Akif9748 2022-09-16 23:38:06 +03:00
parent daa5c36281
commit 7ecf0a51de
7 changed files with 7 additions and 10 deletions

View file

@ -39,13 +39,14 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn
| Better Auth | ⚪ | MEDIUM | | Better Auth | ⚪ | MEDIUM |
- mod role, permissions - mod role, permissions
- Fix footer, theme, category pages - Fix footer's location.
- upload other photos, model for it - upload other photos, model for it
- category system bloat. - category system bloat.
- 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 - desp => description
- threads title and desp black theme, center
- scroll
## Major Version History ## Major Version History
- V4: Caching - V4: Caching
- V3: New Theme - V3: New Theme

View file

@ -9,7 +9,7 @@ app.get("/:id", async (req, res) => {
if (!message || (message.deleted && !req.user?.admin)) return res.error( 404, if (!message || (message.deleted && !req.user?.admin)) return res.error( 404,
`We don't have any message with id ${req.params.id}.`); `We don't have any message with id ${req.params.id}.`);
res.redirect(`/threads/${message.threadID}?scroll=${message.id}`); res.redirect(`/threads/${message.threadID}#message-${message.id}`);
}); });

View file

@ -31,7 +31,7 @@ app.get("/:id/", async (req, res) => {
const messages = await Promise.all(await MessageModel.find(query).sort({ time: 1 }).limit(10).skip(page * 10) const messages = await Promise.all(await MessageModel.find(query).sort({ time: 1 }).limit(10).skip(page * 10)
.then(messages => messages.map(message => message.get_author()))); .then(messages => messages.map(message => message.get_author())));
res.reply("thread", { page, thread, messages, scroll: req.query.scroll || messages[0]?.id }); res.reply("thread", { page, thread, messages });
thread.save(); thread.save();

View file

@ -31,6 +31,7 @@
<a class="btn-primary" onclick="ban();">IP BAN</a> <a class="btn-primary" onclick="ban();">IP BAN</a>
<a class="btn-outline-primary" onclick="unban();">REMOVE IP BAN</a> <a class="btn-outline-primary" onclick="unban();">REMOVE IP BAN</a>
<a href="/categories/create" class="btn-primary">Create Category</a>
<h2 style="color: var(--second);">Banned users:</h2> <h2 style="color: var(--second);">Banned users:</h2>

View file

@ -10,9 +10,6 @@
<%- include("extra/navbar") %> <%- include("extra/navbar") %>
<div class="threads"> <div class="threads">
<%if(user?.admin) {%>
<a href="/categories/create" class="btn-primary">Create Category</a>
<% }; %>
<% categories.forEach(category=>{ %> <% categories.forEach(category=>{ %>
<a href="<%= category.getLink() %>" > <a href="<%= category.getLink() %>" >
<div class="threads-box"> <div class="threads-box">

View file

@ -20,10 +20,9 @@
<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>
<div style="text-align:center;"> <div style="text-align:center;">
By <a href="https://github.com/Akif9748/" style="color: #ffbf00;">Akif</a> <br> By <a href="#" style="color:#ffbf00;">Tokmak</a> <a href="https://github.com/Akif9748/" style="color: #ffbf00;">Akif</a><br><a href="#" style="color:#ffbf00;">Tokmak</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -98,7 +98,6 @@
const content = message.querySelector(".content"); const content = message.querySelector(".content");
content.innerHTML = converter.makeHtml(content.rawText = content.innerHTML); content.innerHTML = converter.makeHtml(content.rawText = content.innerHTML);
} }
document.getElementById("message-<%= scroll %>").scrollIntoView();
function dots(id) { function dots(id) {
document.getElementById('message-' + id).querySelector(".dots-menu").classList.toggle('active') document.getElementById('message-' + id).querySelector(".dots-menu").classList.toggle('active')