Revert "Suppress post thumbnails from loading until they are actually inserted into the index."
This reverts commit 6ad0064f415f0d97c7b6ddaadb2f5f476de2ac8a. Conflicts: src/General/Build.coffee src/General/html/Build/File.html src/Images/ImageLoader.coffee
This commit is contained in:
parent
eb116cf476
commit
6b9059182f
@ -88,11 +88,10 @@ Build =
|
|||||||
.replace(/<[^>]*>/g, '')
|
.replace(/<[^>]*>/g, '')
|
||||||
o.info.comment = Build.unescape html
|
o.info.comment = Build.unescape html
|
||||||
|
|
||||||
postFromObject: (data, boardID, suppressThumb) ->
|
postFromObject: (data, boardID) ->
|
||||||
o = Build.parseJSON data, boardID
|
Build.post Build.parseJSON data, boardID
|
||||||
Build.post o, suppressThumb
|
|
||||||
|
|
||||||
post: (o, suppressThumb) ->
|
post: (o) ->
|
||||||
{postID, threadID, boardID, file} = o
|
{postID, threadID, boardID, file} = o
|
||||||
{subject, email, name, tripcode, capcode, uniqueID, flagCode, flag, dateUTC, dateText, commentHTML} = o.info
|
{subject, email, name, tripcode, capcode, uniqueID, flagCode, flag, dateUTC, dateText, commentHTML} = o.info
|
||||||
{staticPath, gifIcon} = Build
|
{staticPath, gifIcon} = Build
|
||||||
@ -178,7 +177,7 @@ Build =
|
|||||||
root
|
root
|
||||||
|
|
||||||
excerptThread: (board, data, OP) ->
|
excerptThread: (board, data, OP) ->
|
||||||
nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID, true]
|
nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID]
|
||||||
if data.omitted_posts or !Conf['Show Replies'] and data.replies
|
if data.omitted_posts or !Conf['Show Replies'] and data.replies
|
||||||
[posts, files] = if Conf['Show Replies']
|
[posts, files] = if Conf['Show Replies']
|
||||||
# XXX data.omitted_images is not accurate.
|
# XXX data.omitted_images is not accurate.
|
||||||
|
|||||||
@ -650,10 +650,6 @@ Index =
|
|||||||
|
|
||||||
buildStructure: (nodes) ->
|
buildStructure: (nodes) ->
|
||||||
for node in 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']
|
$.add Index.root, [node, $.el 'hr']
|
||||||
$.event 'PostsInserted' if doc.contains Index.root
|
$.event 'PostsInserted' if doc.contains Index.root
|
||||||
ThreadHiding.onIndexBuild nodes
|
ThreadHiding.onIndexBuild nodes
|
||||||
|
|||||||
@ -15,8 +15,8 @@
|
|||||||
(${file.size}, ${file.dimensions || "PDF"})
|
(${file.size}, ${file.dimensions || "PDF"})
|
||||||
</div>
|
</div>
|
||||||
<a class="fileThumb?{file.isSpoiler}{ imgspoiler}{}" href="${fileURL}" target="_blank">
|
<a class="fileThumb?{file.isSpoiler}{ imgspoiler}{}" href="${fileURL}" target="_blank">
|
||||||
<img
|
<img
|
||||||
?{suppressThumb}{ data-src="${fileThumb}"}{ src="${fileThumb}"}
|
src="${fileThumb}"
|
||||||
alt="${file.size}"
|
alt="${file.size}"
|
||||||
data-md5="${file.MD5}"
|
data-md5="${file.MD5}"
|
||||||
style="height: ${file.isSpoiler ? 100 : file.theight}px; width: ${file.isSpoiler ? 100 : file.twidth}px;"
|
style="height: ${file.isSpoiler ? 100 : file.theight}px; width: ${file.isSpoiler ? 100 : file.twidth}px;"
|
||||||
|
|||||||
@ -65,11 +65,6 @@ class Clone extends Post
|
|||||||
|
|
||||||
@file.thumb.muted = true if @file.videoThumb
|
@file.thumb.muted = true if @file.videoThumb
|
||||||
|
|
||||||
if @file.thumb?.dataset.src
|
|
||||||
@file.thumb.src = @file.thumb.dataset.src
|
|
||||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
|
||||||
@file.thumb.removeAttribute 'data-src'
|
|
||||||
|
|
||||||
# Contract thumbnails in quote preview
|
# Contract thumbnails in quote preview
|
||||||
ImageExpand.contract @ if @file.thumb and contractThumb
|
ImageExpand.contract @ if @file.thumb and contractThumb
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ ImageLoader =
|
|||||||
preload: 'none'
|
preload: 'none'
|
||||||
loop: true
|
loop: true
|
||||||
muted: true
|
muted: true
|
||||||
poster: thumb.src or thumb.dataset.src
|
poster: thumb.src
|
||||||
textContent: thumb.alt
|
textContent: thumb.alt
|
||||||
className: thumb.className
|
className: thumb.className
|
||||||
video.setAttribute 'muted', 'muted'
|
video.setAttribute 'muted', 'muted'
|
||||||
@ -55,7 +55,7 @@ ImageLoader =
|
|||||||
{isImage, isVideo, thumb, url} = file
|
{isImage, isVideo, thumb, url} = file
|
||||||
return if file.isPrefetched or !(isImage or isVideo) or post.isHidden or post.thread.isHidden
|
return if file.isPrefetched or !(isImage or isVideo) or post.isHidden or post.thread.isHidden
|
||||||
type = if (match = url.match(/\.([^.]+)$/)[1].toUpperCase()) is 'JPEG' then 'JPG' else match
|
type = if (match = url.match(/\.([^.]+)$/)[1].toUpperCase()) is 'JPEG' then 'JPG' else match
|
||||||
replace = Conf["Replace #{type}"] and !/spoiler/.test(thumb.src or thumb.dataset.src)
|
replace = Conf["Replace #{type}"] and !/spoiler/.test thumb.src
|
||||||
return unless replace or Conf['prefetch']
|
return unless replace or Conf['prefetch']
|
||||||
return unless [post, post.clones...].some (clone) -> doc.contains clone.nodes.root
|
return unless [post, post.clones...].some (clone) -> doc.contains clone.nodes.root
|
||||||
file.isPrefetched = true
|
file.isPrefetched = true
|
||||||
@ -72,8 +72,6 @@ ImageLoader =
|
|||||||
$.on el, 'load', ->
|
$.on el, 'load', ->
|
||||||
clone.file.thumb.src = url for clone in post.clones
|
clone.file.thumb.src = url for clone in post.clones
|
||||||
thumb.src = url
|
thumb.src = url
|
||||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
|
||||||
thumb.removeAttribute 'data-src'
|
|
||||||
el.src = url
|
el.src = url
|
||||||
|
|
||||||
toggle: ->
|
toggle: ->
|
||||||
|
|||||||
@ -13,7 +13,4 @@ RevealSpoilers =
|
|||||||
thumb.removeAttribute 'style'
|
thumb.removeAttribute 'style'
|
||||||
# Enforce thumbnail size if thumbnail is replaced.
|
# Enforce thumbnail size if thumbnail is replaced.
|
||||||
thumb.style.maxHeight = thumb.style.maxWidth = if @isReply then '125px' else '250px'
|
thumb.style.maxHeight = thumb.style.maxWidth = if @isReply then '125px' else '250px'
|
||||||
if thumb.src
|
thumb.src = @file.thumbURL
|
||||||
thumb.src = @file.thumbURL
|
|
||||||
else
|
|
||||||
thumb.dataset.src = @file.thumbURL
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user