From d1abf7541f6acc59ef1302fd6a326621bd1007e2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 24 Apr 2013 16:27:02 +0200 Subject: [PATCH] Fix unread scroll. --- src/features.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/features.coffee b/src/features.coffee index 6a00dd7c7..728d3fa58 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -3859,15 +3859,16 @@ Unread = scroll: -> # Let the header's onload callback handle it. - return if (hash = location.hash.match /\d+/) and hash[0] of @posts + return if (hash = location.hash.match /\d+/) and hash[0] of Unread.thread.posts if Unread.posts.length # Scroll to before the first unread post. while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root break unless (Get.postFromRoot root).isHidden root.scrollIntoView false - else if posts.length - # Scroll to the last read post. - Header.scrollToPost posts[posts.length - 1].nodes.root + return + # Scroll to the last read post. + posts = Object.keys Unread.thread.posts + Header.scrollToPost Unread.thread.posts[posts[posts.length - 1]].nodes.root sync: -> lastReadPost = Unread.db.get