diff --git a/4chan_x.user.js b/4chan_x.user.js index bc754d053..c33e9a5a9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -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); } }, diff --git a/script.coffee b/script.coffee index 66b26cfae..fd975629e 100644 --- a/script.coffee +++ b/script.coffee @@ -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',