Multifile support in ImageCommon.error. #2171
This commit is contained in:
parent
1bf75fdca0
commit
7b02e10cd5
@ -195,7 +195,9 @@ Gallery =
|
||||
if @error?.code is MediaError.MEDIA_ERR_DECODE
|
||||
return new Notice 'error', 'Corrupt or unplayable video', 30
|
||||
return if ImageCommon.isFromArchive @
|
||||
ImageCommon.error @, g.posts[@dataset.post], null, (url) =>
|
||||
post = g.posts[@dataset.post]
|
||||
file = post.file
|
||||
ImageCommon.error @, post, file, null, (url) =>
|
||||
return unless url
|
||||
Gallery.images[@dataset.id].href = url
|
||||
(@src = url if Gallery.nodes.current is @)
|
||||
|
||||
@ -36,8 +36,8 @@ ImageCommon =
|
||||
isFromArchive: (file) ->
|
||||
g.SITE.software is 'yotsuba' and !ImageHost.test(file.src.split('/')[2])
|
||||
|
||||
error: (file, post, delay, cb) ->
|
||||
src = post.file.url.split '/'
|
||||
error: (file, post, fileObj, delay, cb) ->
|
||||
src = fileObj.url.split '/'
|
||||
url = null
|
||||
if g.SITE.software is 'yotsuba' and Conf['404 Redirect']
|
||||
url = Redirect.to 'file', {
|
||||
@ -46,10 +46,10 @@ ImageCommon =
|
||||
}
|
||||
url = null unless url and Redirect.securityCheck(url)
|
||||
|
||||
return cb url if (post.isDead or post.file.isDead) and not ImageCommon.isFromArchive(file)
|
||||
return cb url if (post.isDead or fileObj.isDead) and not ImageCommon.isFromArchive(file)
|
||||
|
||||
timeoutID = setTimeout (-> cb url), delay if delay?
|
||||
return if post.isDead or post.file.isDead
|
||||
return if post.isDead or fileObj.isDead
|
||||
redirect = ->
|
||||
unless ImageCommon.isFromArchive file
|
||||
clearTimeout timeoutID if delay?
|
||||
@ -65,11 +65,11 @@ ImageCommon =
|
||||
if postObj.no isnt post.ID
|
||||
post.kill()
|
||||
redirect()
|
||||
else if postObj.filedeleted
|
||||
else if fileObj.docIndex in g.SITE.Build.parseJSON(postObj, post.board).filesDeleted
|
||||
post.kill true
|
||||
redirect()
|
||||
else
|
||||
url = post.file.url
|
||||
url = fileObj.url
|
||||
|
||||
# Add controls, but not until the mouse is moved over the video.
|
||||
addControls: (video) ->
|
||||
|
||||
@ -272,7 +272,7 @@ ImageExpand =
|
||||
# Don't autoretry images from the archive.
|
||||
if ImageCommon.isFromArchive @
|
||||
return ImageExpand.contract post
|
||||
ImageCommon.error @, post, 10 * $.SECOND, (URL) ->
|
||||
ImageCommon.error @, post, post.file, 10 * $.SECOND, (URL) ->
|
||||
if post.file.isExpanding or post.file.isExpanded
|
||||
ImageExpand.contract post
|
||||
(ImageExpand.expand post, URL if URL)
|
||||
|
||||
@ -71,7 +71,7 @@ ImageHover =
|
||||
|
||||
error: (post, file) -> ->
|
||||
return if ImageCommon.decodeError @, file
|
||||
ImageCommon.error @, post, 3 * $.SECOND, (URL) =>
|
||||
ImageCommon.error @, post, file, 3 * $.SECOND, (URL) =>
|
||||
if URL
|
||||
@src = URL + if @src is URL then '?' + Date.now() else ''
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user