mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 20:10:40 +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);
|
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.");
|
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;
|
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
|
} else
|
||||||
res.error( 404, "We have not got this thread.");
|
res.error( 404, "We have not got this thread.");
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,10 +48,13 @@
|
||||||
<% }%>
|
<% }%>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% if (user){ %>
|
<% if (user){ %>
|
||||||
<script type="module" src="/js/thread.js"></script>
|
<script type="module" src="/js/thread.js"></script>
|
||||||
<% }%>
|
<% }%>
|
||||||
|
<script>
|
||||||
|
document.getElementById("message-<%= scroll %>").scrollIntoView();
|
||||||
|
</script>
|
||||||
<%- include("extra/footer") %>
|
<%- include("extra/footer") %>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue