From f14e850af00c27ef2b18593b4b626313292e41eb Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 22 Jan 2016 19:49:57 -0800 Subject: [PATCH] Revert "Revert "Suppress post thumbnails from loading until they are actually inserted into the index."" This reverts commit 6b9059182fdf97001f013efc57150ff3dc14d80a. --- src/General/Build.coffee | 9 +++++---- src/General/Index.coffee | 4 ++++ src/General/html/Build/File.html | 4 ++-- src/General/lib/clone.class | 5 +++++ src/Images/ImageLoader.coffee | 6 ++++-- src/Images/RevealSpoilers.coffee | 5 ++++- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 1854fd9bd..0b76f84e1 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -88,10 +88,11 @@ Build = .replace(/<[^>]*>/g, '') o.info.comment = Build.unescape html - postFromObject: (data, boardID) -> - Build.post Build.parseJSON data, boardID + postFromObject: (data, boardID, suppressThumb) -> + o = Build.parseJSON data, boardID + Build.post o, suppressThumb - post: (o) -> + post: (o, suppressThumb) -> {postID, threadID, boardID, file} = o {subject, email, name, tripcode, capcode, uniqueID, flagCode, flag, dateUTC, dateText, commentHTML} = o.info {staticPath, gifIcon} = Build @@ -177,7 +178,7 @@ Build = root excerptThread: (board, data, OP) -> - nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID] + nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID, true] if data.omitted_posts or !Conf['Show Replies'] and data.replies [posts, files] = if Conf['Show Replies'] # XXX data.omitted_images is not accurate. diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 36074be29..d099d3d08 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -650,6 +650,10 @@ Index = buildStructure: (nodes) -> for node in nodes + if thumb = $ 'img[data-src]', node + thumb.src = thumb.dataset.src + # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289 + thumb.removeAttribute 'data-src' $.add Index.root, [node, $.el 'hr'] $.event 'PostsInserted' if doc.contains Index.root ThreadHiding.onIndexBuild nodes diff --git a/src/General/html/Build/File.html b/src/General/html/Build/File.html index 5d3014a24..d48f11db2 100644 --- a/src/General/html/Build/File.html +++ b/src/General/html/Build/File.html @@ -15,8 +15,8 @@ (${file.size}, ${file.dimensions || "PDF"}) - ${file.size} doc.contains clone.nodes.root file.isPrefetched = true @@ -72,6 +72,8 @@ ImageLoader = $.on el, 'load', -> clone.file.thumb.src = url for clone in post.clones thumb.src = url + # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289 + thumb.removeAttribute 'data-src' el.src = url toggle: -> diff --git a/src/Images/RevealSpoilers.coffee b/src/Images/RevealSpoilers.coffee index 4c3e65709..ed159a4ca 100755 --- a/src/Images/RevealSpoilers.coffee +++ b/src/Images/RevealSpoilers.coffee @@ -13,4 +13,7 @@ RevealSpoilers = thumb.removeAttribute 'style' # Enforce thumbnail size if thumbnail is replaced. thumb.style.maxHeight = thumb.style.maxWidth = if @isReply then '125px' else '250px' - thumb.src = @file.thumbURL + if thumb.src + thumb.src = @file.thumbURL + else + thumb.dataset.src = @file.thumbURL