Multifile support in ImageCommon.decodeError. #2171

This commit is contained in:
ccd0 2019-07-15 13:17:19 -07:00
parent 2fadf026b3
commit b588ca43fd
3 changed files with 7 additions and 7 deletions

View File

@ -25,11 +25,11 @@ ImageCommon =
cacheError: ->
delete ImageCommon.cache if ImageCommon.cache is @
decodeError: (file, post) ->
decodeError: (file, fileObj) ->
return false unless file.error?.code is MediaError.MEDIA_ERR_DECODE
if not (message = $ '.warning', post.file.thumb.parentNode)
if not (message = $ '.warning', fileObj.thumb.parentNode)
message = $.el 'div', className: 'warning'
$.after post.file.thumb, message
$.after fileObj.thumb, message
message.textContent = 'Error: Corrupt or unplayable video'
return true

View File

@ -267,7 +267,7 @@ ImageExpand =
# - after the image started loading.
# Don't try to re-expand if it was already contracted.
return unless post.file.isExpanding or post.file.isExpanded
if ImageCommon.decodeError @, post
if ImageCommon.decodeError @, post.file
return ImageExpand.contract post
# Don't autoretry images from the archive.
if ImageCommon.isFromArchive @

View File

@ -23,7 +23,7 @@ ImageHover =
return unless doc.contains @
{isVideo} = file
return if file.isExpanding or file.isExpanded or g.SITE.isThumbExpanded?(file)
error = ImageHover.error post
error = ImageHover.error post, file
if ImageCommon.cache?.dataset.fullID is post.fullID
el = ImageCommon.popCache()
$.on el, 'error', error
@ -69,8 +69,8 @@ ImageHover =
$.rm el
el.removeAttribute 'style'
error: (post) -> ->
return if ImageCommon.decodeError @, post
error: (post, file) -> ->
return if ImageCommon.decodeError @, file
ImageCommon.error @, post, 3 * $.SECOND, (URL) =>
if URL
@src = URL + if @src is URL then '?' + Date.now() else ''