Retry if and only if we're sure the picture 404'd.

This commit is contained in:
Nicolas Stepien 2011-09-24 15:56:52 +02:00
parent e319beae48
commit fe45fcb4f0
2 changed files with 11 additions and 8 deletions

View File

@ -2734,15 +2734,18 @@
return $.add(a, img);
},
error: function(e) {
var thumb;
var req, thumb;
thumb = this.previousSibling;
imgExpand.contract(thumb);
if (!g.dead) {
return setTimeout(imgExpand.retry, 10000, thumb);
}
req = $.ajax(this.src, null, 'head');
return req.onreadystatechange = function(e) {
if (this.status !== 404) {
return setTimeout(imgExpand.retry, 10000, thumb);
}
};
},
retry: function(thumb) {
if (!(g.dead || thumb.hidden)) {
if (!thumb.hidden) {
return imgExpand.expand(thumb);
}
},

View File

@ -2026,10 +2026,10 @@ imgExpand =
thumb = @previousSibling
imgExpand.contract thumb
#navigator.online is not x-browser/os yet
#can't easily check if the image/post is deleted
setTimeout imgExpand.retry, 10000, thumb unless g.dead
req = $.ajax @src, null, 'head'
req.onreadystatechange = (e) -> setTimeout imgExpand.retry, 10000, thumb if @status isnt 404
retry: (thumb) ->
imgExpand.expand thumb unless g.dead or thumb.hidden
imgExpand.expand thumb unless thumb.hidden
dialog: ->
controls = $.el 'div',