From f18099b435c5e69874bba7fd8f093b886a8f5d0a Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 16 Apr 2016 22:45:20 -0500 Subject: [PATCH] actually don't delay image loading when "delay image loading" is unchecked --- public/src/client/topic/posts.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 996dcbc6b9..9ad98eae97 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -239,11 +239,13 @@ define('forum/topic/posts', [ Posts.unloadImages = function(posts) { var images = posts.find('[component="post/content"] img:not(.not-responsive)'); - images.each(function() { - $(this).attr('data-src', $(this).attr('src')); - $(this).attr('data-state', 'unloaded'); - $(this).attr('src', 'about:blank'); - }); + if (config.delayImageLoading) { + images.each(function() { + $(this).attr('data-src', $(this).attr('src')); + }).attr('data-state', 'unloaded').attr('src', 'about:blank'); + } else { + images.attr('data-state', 'loaded'); + } }; Posts.loadImages = function(threshold) { @@ -263,7 +265,7 @@ define('forum/topic/posts', [ var images = components.get('post/content').find('img[data-state="unloaded"]'), visible = images.filter(function() { - return config.delayImageLoading ? utils.isElementInViewport(this) : true; + return utils.isElementInViewport(this); }), scrollTop = $(window).scrollTop(), adjusting = false,