mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-12-22 23:59:08 +03:00
scroll
This commit is contained in:
parent
5414271924
commit
7283404184
3 changed files with 6 additions and 3 deletions
|
@ -8,7 +8,7 @@ app.get("/:id", async (req, res) => {
|
|||
const message = await MessageModel.get(req.params.id);
|
||||
|
||||
if (!message || (message.deleted && req.user && !req.user.admin)) return res.error( 404, "We have not got any message declared as this id.");
|
||||
res.redirect("/threads/" + message.threadID);
|
||||
res.redirect("/threads/" + message.threadID+"?scroll="+req.params.id);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ app.get("/:id", async (req, res) => {
|
|||
return user?.admin || !message?.deleted ? message : null;
|
||||
}));
|
||||
|
||||
res.render("thread", { thread, messages, user })
|
||||
res.render("thread", { thread, messages, user,scroll:req.query.scroll || false });
|
||||
} else
|
||||
res.error( 404, "We have not got this thread.");
|
||||
});
|
||||
|
|
|
@ -48,10 +48,13 @@
|
|||
<% }%>
|
||||
|
||||
</form>
|
||||
|
||||
<% if (user){ %>
|
||||
<script type="module" src="/js/thread.js"></script>
|
||||
<% }%>
|
||||
|
||||
<script>
|
||||
document.getElementById("message-<%= scroll %>").scrollIntoView();
|
||||
</script>
|
||||
<%- include("extra/footer") %>
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in a new issue