From 09642b63dae868f2ead43b3890ed55bb2b59c8c6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 31 Mar 2013 00:29:28 +0100 Subject: [PATCH] When there is a valid hash, scroll to corresponding post instead of the unread posts. #968 --- src/features.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/features.coffee b/src/features.coffee index e7de9d402..91d4a6147 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -3633,7 +3633,9 @@ Unread = $.get "lastReadPosts.#{@board}", threads: {}, (item) => Unread.lastReadPost = item["lastReadPosts.#{@board}"].threads[@] or 0 Unread.addPosts posts - if Unread.posts.length + if (hash = location.hash.match /\d+/) and post = @posts[hash[0]] + post.nodes.root.scrollIntoView() + else if Unread.posts.length # Scroll to before the first unread post. $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root).scrollIntoView false else if posts.length