copy details at moment of replacement and from the correct thumb (in case of clones)

This commit is contained in:
ccd0 2014-09-07 14:52:16 -07:00
parent 656685a9be
commit d0247840d1

View File

@ -43,15 +43,6 @@ ImageLoader =
if @file.isSpoiler if @file.isSpoiler
# Revealed spoilers do not have height/width set, this fixes the image's dimensions. # Revealed spoilers do not have height/width set, this fixes the image's dimensions.
style.maxHeight = style.maxWidth = if @isReply then '125px' else '250px' style.maxHeight = style.maxWidth = if @isReply then '125px' else '250px'
if isVideo
el.textContent = thumb.alt
el.dataset.md5 = thumb.dataset.md5
el.style.height = style.height
el.style.width = style.width
el.style.maxHeight = style.maxHeight
el.style.maxWidth = style.maxWidth
el.loop = true
el.className = thumb.className
cb = => cb = =>
$.off el, 'load loadeddata', cb $.off el, 'load loadeddata', cb
ImageLoader.replace @, el ImageLoader.replace @, el
@ -79,11 +70,20 @@ ImageLoader =
replace: (post, el) -> replace: (post, el) ->
{file} = post {file} = post
{isVideo, thumb} = file {isVideo, thumb} = file
{style} = thumb
if !post.isClone if !post.isClone
# Replace the thumbnail in clones added before the file was loaded. # Replace the thumbnail in clones added before the file was loaded.
for clone in post.clones for clone in post.clones
ImageLoader.replace clone, el.cloneNode true ImageLoader.replace clone, el.cloneNode true
if isVideo if isVideo
el.textContent = thumb.alt
el.dataset.md5 = thumb.dataset.md5
el.style.height = style.height
el.style.width = style.width
el.style.maxHeight = style.maxHeight
el.style.maxWidth = style.maxWidth
el.loop = true
el.className = thumb.className
$.on el, 'mouseover', ImageHover.mouseover if Conf['Image Hover'] $.on el, 'mouseover', ImageHover.mouseover if Conf['Image Hover']
$.replace thumb, el $.replace thumb, el
file.videoThumb = true file.videoThumb = true