diff --git a/4chan_x.user.js b/4chan_x.user.js index a4b74be2c..14d46fec2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -100,6 +100,7 @@ Imaging: { 'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Expansion': [true, 'Expand images'], + 'Expand All (Unscrolled)': [false, 'Expand all images will only expand those which you have not scrolled past'], 'Image Hover': [false, 'Show full image on mouseover'], 'Sauce': [true, 'Add sauce to images'], 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] @@ -3393,7 +3394,13 @@ _ref = $$('img[md5]'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { thumb = _ref[_i]; - imgExpand.expand(thumb); + if (conf['Expand All (Unscrolled)']) { + if (thumb.getBoundingClientRect().bottom >= 0) { + imgExpand.expand(thumb); + } + } else { + imgExpand.expand(thumb); + } } } else { _ref2 = $$('img[md5][hidden]'); diff --git a/script.coffee b/script.coffee index d2b2d593a..a4ea526a9 100644 --- a/script.coffee +++ b/script.coffee @@ -22,6 +22,7 @@ config = Imaging: 'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Expansion': [true, 'Expand images'] + 'Expand All (Unscrolled)': [false, 'Expand all images will only expand those which you have not scrolled past'] 'Image Hover': [false, 'Show full image on mouseover'] 'Sauce': [true, 'Add sauce to images'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] @@ -2664,7 +2665,11 @@ imgExpand = imgExpand.on = @checked if imgExpand.on #expand for thumb in $$ 'img[md5]' - imgExpand.expand thumb + if conf['Expand All (Unscrolled)'] + if thumb.getBoundingClientRect().bottom >= 0 + imgExpand.expand thumb + else + imgExpand.expand thumb else #contract for thumb in $$ 'img[md5][hidden]' imgExpand.contract thumb