Clean up, improve, retry arbitrarily every 10 seconds as to not shit up 4chan's servers even more.

This commit is contained in:
Nicolas Stepien 2011-09-23 01:34:18 +02:00
parent 3333bfe488
commit 62f697cca6
2 changed files with 24 additions and 12 deletions

View File

@ -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', {

View File

@ -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'