Fetch the image's HEAD status to see if it's still available or not.
Chrome bypasses the lack of CORS because we've allowed `i.4cdn.org` in the manifest.
This commit is contained in:
parent
c7c8ea9ec5
commit
1eaf43e39a
@ -132,6 +132,15 @@ ImageExpand =
|
|||||||
return
|
return
|
||||||
|
|
||||||
timeoutID = setTimeout ImageExpand.expand, 10000, post
|
timeoutID = setTimeout ImageExpand.expand, 10000, post
|
||||||
|
<% if (type === 'crx') { %>
|
||||||
|
$.ajax @src,
|
||||||
|
onloadend: ->
|
||||||
|
return if @status isnt 404
|
||||||
|
clearTimeout timeoutID
|
||||||
|
post.kill true
|
||||||
|
,
|
||||||
|
type: 'head'
|
||||||
|
<% } else { %>
|
||||||
# XXX CORS for i.4cdn.org WHEN?
|
# XXX CORS for i.4cdn.org WHEN?
|
||||||
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
||||||
return if @status isnt 200
|
return if @status isnt 200
|
||||||
@ -143,6 +152,7 @@ ImageExpand =
|
|||||||
else if postObj.filedeleted
|
else if postObj.filedeleted
|
||||||
clearTimeout timeoutID
|
clearTimeout timeoutID
|
||||||
post.kill true
|
post.kill true
|
||||||
|
<% } %>
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
@ -38,6 +38,15 @@ ImageHover =
|
|||||||
return
|
return
|
||||||
|
|
||||||
timeoutID = setTimeout (=> @src = post.file.URL + '?' + Date.now()), 3000
|
timeoutID = setTimeout (=> @src = post.file.URL + '?' + Date.now()), 3000
|
||||||
|
<% if (type === 'crx') { %>
|
||||||
|
$.ajax @src,
|
||||||
|
onloadend: ->
|
||||||
|
return if @status isnt 404
|
||||||
|
clearTimeout timeoutID
|
||||||
|
post.kill true
|
||||||
|
,
|
||||||
|
type: 'head'
|
||||||
|
<% } else { %>
|
||||||
# XXX CORS for i.4cdn.org WHEN?
|
# XXX CORS for i.4cdn.org WHEN?
|
||||||
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
||||||
return if @status isnt 200
|
return if @status isnt 200
|
||||||
@ -49,3 +58,4 @@ ImageHover =
|
|||||||
else if postObj.filedeleted
|
else if postObj.filedeleted
|
||||||
clearTimeout timeoutID
|
clearTimeout timeoutID
|
||||||
post.kill true
|
post.kill true
|
||||||
|
<% } %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user