Fix scrollToLinkedComment()

The test was done against location.hash, which contains a hash symbol.
Strip it for the test.
This commit is contained in:
Pablo Vazquez 2018-03-14 21:58:12 +01:00
parent df6297d40f
commit 7292c534ed

View File

@ -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 %}