simplify ImageCommon.error
This commit is contained in:
parent
5e2ccfee2d
commit
e9ac861ad9
@ -8,14 +8,21 @@ ImageCommon =
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
error: (file, post, delay, cb) ->
|
error: (file, post, delay, cb) ->
|
||||||
return ImageCommon.retry post, cb if (post.isDead or post.file.isDead) and file.src.split('/')[2] is 'i.4cdn.org'
|
src = post.file.URL.split '/'
|
||||||
|
URL = Redirect.to 'file',
|
||||||
|
boardID: post.board.ID
|
||||||
|
filename: src[src.length - 1]
|
||||||
|
unless URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
|
||||||
|
URL = null
|
||||||
|
|
||||||
timeoutID = setTimeout ImageCommon.retry, delay, post, cb if delay?
|
return cb URL if (post.isDead or post.file.isDead) and file.src.split('/')[2] is 'i.4cdn.org'
|
||||||
|
|
||||||
|
timeoutID = setTimeout cb, delay, post.file.URL if delay?
|
||||||
return if post.isDead or post.file.isDead
|
return if post.isDead or post.file.isDead
|
||||||
kill = (fileOnly) ->
|
kill = (fileOnly) ->
|
||||||
clearTimeout timeoutID
|
clearTimeout timeoutID if delay?
|
||||||
post.kill fileOnly
|
post.kill fileOnly
|
||||||
ImageCommon.retry post, cb
|
cb URL
|
||||||
|
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
$.ajax post.file.URL,
|
$.ajax post.file.URL,
|
||||||
@ -37,17 +44,6 @@ ImageCommon =
|
|||||||
kill true
|
kill true
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
retry: (post, cb) ->
|
|
||||||
unless post.isDead or post.file.isDead
|
|
||||||
return cb post.file.URL
|
|
||||||
src = post.file.URL.split '/'
|
|
||||||
URL = Redirect.to 'file',
|
|
||||||
boardID: post.board.ID
|
|
||||||
filename: src[src.length - 1]
|
|
||||||
if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
|
|
||||||
return cb URL
|
|
||||||
cb null # report nothing to retry
|
|
||||||
|
|
||||||
# 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) ->
|
||||||
handler = ->
|
handler = ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user