mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-19 19:11:05 +01:00
feat: clicking on timeago permalink of a nested reply
will scroll to that post if it is already on the page just like parent timeago links
This commit is contained in:
@@ -270,15 +270,16 @@ define('forum/topic', [
|
|||||||
hooks.registerPage('action:posts.edited', addCopyCodeButton);
|
hooks.registerPage('action:posts.edited', addCopyCodeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addParentHandler() {
|
function gotoPost(event, toPid) {
|
||||||
function gotoPost(event, toPid) {
|
const toPost = $(`[component="topic"]>[component="post"][data-pid="${toPid}"]`);
|
||||||
const toPost = $('[component="topic"]>[component="post"][data-pid="' + toPid + '"]');
|
if (toPost.length) {
|
||||||
if (toPost.length) {
|
event.preventDefault();
|
||||||
event.preventDefault();
|
navigator.scrollToIndex(toPost.attr('data-index'), true);
|
||||||
navigator.scrollToIndex(toPost.attr('data-index'), true);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addParentHandler() {
|
||||||
components.get('topic').on('click', '[component="post/parent"]', function (e) {
|
components.get('topic').on('click', '[component="post/parent"]', function (e) {
|
||||||
const parentEl = $(this);
|
const parentEl = $(this);
|
||||||
const contentEl = parentEl.find('[component="post/parent/content"]');
|
const contentEl = parentEl.find('[component="post/parent/content"]');
|
||||||
@@ -308,6 +309,10 @@ define('forum/topic', [
|
|||||||
replies.init(btn);
|
replies.init(btn);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('[component="topic"]').on('click', '[component="post/replies"] .post-header a.timeago', function (e) {
|
||||||
|
return gotoPost(e, $(this).parents('[data-pid]').attr('data-pid'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPostsPreviewHandler() {
|
function addPostsPreviewHandler() {
|
||||||
|
|||||||
Reference in New Issue
Block a user