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