From df62c78ed922fc4a5a791070d003515ecf6afe6e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 30 Oct 2013 17:25:22 +0100 Subject: [PATCH] After an index refresh, only scroll down if needed. --- src/General/Header.coffee | 4 ++-- src/Miscellaneous/Index.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 7eb6e06fe..12533ca17 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -247,8 +247,8 @@ Header = return unless (hash = @location.hash[1..]) and post = $.id hash return if (Get.postFromRoot post).isHidden Header.scrollTo post - scrollTo: (post) -> - {top} = post.getBoundingClientRect() + scrollTo: (root) -> + {top} = root.getBoundingClientRect() unless Conf['Bottom header'] headRect = Header.toggle.getBoundingClientRect() top -= headRect.top + headRect.height diff --git a/src/Miscellaneous/Index.coffee b/src/Miscellaneous/Index.coffee index a4287e188..44db465b6 100644 --- a/src/Miscellaneous/Index.coffee +++ b/src/Miscellaneous/Index.coffee @@ -67,7 +67,7 @@ Index = notice.el.lastElementChild.textContent = 'Index refreshed!' setTimeout notice.close, $.SECOND - Header.scrollTo $.id 'delform' + Header.scrollTo Index.root if Index.root.getBoundingClientRect().top < 0 parse: (pages) -> if Conf['Index Mode'] is 'paged' pageNum = +window.location.pathname.split('/')[2]