diff --git a/4chan_x.user.js b/4chan_x.user.js index 99a352ee3..f2681f928 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2728,16 +2728,23 @@ _ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1]; img.style.maxWidth = "-moz-calc(" + max + "px)"; } - $.bind(img, 'error', function(e) { - thumb = this.previousSibling; - imgExpand.contract(thumb); - if (!g.dead) { - return setTimeout(imgExpand.expand, 1000, thumb); - } - }); + $.bind(img, 'error', imgExpand.error); thumb.hidden = true; return $.add(a, img); }, + error: function(e) { + var thumb; + thumb = this.previousSibling; + imgExpand.contract(thumb); + if (!g.dead) { + return setTimeout(imgExpand.retry, 10000, thumb); + } + }, + retry: function(thumb) { + if (!(g.dead || thumb.hidden)) { + return imgExpand.expand(thumb); + } + }, dialog: function() { var controls, delform, imageType, option, select, _i, _len, _ref; controls = $.el('div', { diff --git a/script.coffee b/script.coffee index b9b3b19f0..6723e9c35 100644 --- a/script.coffee +++ b/script.coffee @@ -2021,14 +2021,19 @@ imgExpand = filesize = $ 'span.filesize', a.parentNode [_, max] = filesize.textContent.match /(\d+)x/ img.style.maxWidth = "-moz-calc(#{max}px)" - $.bind img, 'error', (e) -> - thumb = @previousSibling - imgExpand.contract thumb - unless g.dead - setTimeout imgExpand.expand, 1000, thumb + $.bind img, 'error', imgExpand.error thumb.hidden = true $.add a, img + error: (e) -> + 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 + retry: (thumb) -> + imgExpand.expand thumb unless g.dead or thumb.hidden + dialog: -> controls = $.el 'div', id: 'imgControls'