From 34c34df5a8fdb9d7a9a4b356037435c68ae0ec57 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 27 Jul 2014 09:33:32 -0700 Subject: [PATCH] only scroll images into view when expanded if they are individually clicked --- src/Images/ImageExpand.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 2ec3293ef..6ecd4cca5 100755 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -84,6 +84,7 @@ ImageExpand = toggle: (post) -> unless post.file.isExpanding or post.file.isExpanded + post.file.scrollIntoView = true ImageExpand.expand post return @@ -116,7 +117,7 @@ ImageExpand = $.rmClass post.nodes.root, 'expanded-image' $.rmClass file.thumb, 'expanding' $.rm file.videoControls if file.videoControls - for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying'] + for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView'] delete file[x] if el = file.fullImage $.off el, 'error', ImageExpand.error @@ -183,9 +184,11 @@ ImageExpand = window.scrollBy 0, bottom - oldBottom # Scroll to display full image. - imageBottom = Header.getBottomOf file.fullImage - if imageBottom + height >= 0 and imageBottom < 0 - window.scrollBy 0, Math.min(-imageBottom, Header.getTopOf file.fullImage) + if file.scrollIntoView + delete file.scrollIntoView + imageBottom = Header.getBottomOf file.fullImage + if imageBottom + height >= 0 and imageBottom < 0 + window.scrollBy 0, Math.min(-imageBottom, Header.getTopOf file.fullImage) if file.isVideo ImageExpand.play post if Conf['Autoplay']