From 7292c534ed5609fd73ae79c989ea6b8e6980a614 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Wed, 14 Mar 2018 21:58:12 +0100 Subject: [PATCH] Fix scrollToLinkedComment() The test was done against location.hash, which contains a hash symbol. Strip it for the test. --- src/templates/nodes/custom/comment/list_embed_base.pug | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/templates/nodes/custom/comment/list_embed_base.pug b/src/templates/nodes/custom/comment/list_embed_base.pug index 4856a0bd..7ffa47d9 100644 --- a/src/templates/nodes/custom/comment/list_embed_base.pug +++ b/src/templates/nodes/custom/comment/list_embed_base.pug @@ -100,12 +100,13 @@ script. var scrollToId = location.hash; // Check that it's a valid ObjectID before passing it to jQuery. - if (!/^[a-fA-F0-9]{24}$/.test(scrollToId)) return; + if (!/^[a-fA-F0-9]{24}$/.test(scrollToId.replace('#',''))) return; $(scrollToId) .addClass('comment-linked') .scrollHere(); } + $(scrollToLinkedComment); {% endif %}