Refactor and fix. This won't wait for an answer from images.4chan.org to see if the picture 404'd or not.
This commit is contained in:
parent
43df119987
commit
18525ecee1
@ -3293,7 +3293,7 @@
|
|||||||
return $.add(a, img);
|
return $.add(a, img);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
var href, req, src, thumb, url;
|
var href, src, thumb, timeoutID, url;
|
||||||
href = this.parentNode.href;
|
href = this.parentNode.href;
|
||||||
thumb = this.previousSibling;
|
thumb = this.previousSibling;
|
||||||
imgExpand.contract(thumb);
|
imgExpand.contract(thumb);
|
||||||
@ -3302,20 +3302,16 @@
|
|||||||
setTimeout(imgExpand.expand, 10000, thumb, url);
|
setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (g.dead) return;
|
||||||
url = href + '?' + Date.now();
|
url = href + '?' + Date.now();
|
||||||
if (engine === 'webkit') {
|
timeoutID = setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||||
return req = $.ajax(this.src, {
|
return $.ajax(this.src, {
|
||||||
onreadystatechange: (function() {
|
onreadystatechange: (function() {
|
||||||
if (this.status !== 404) {
|
if (this.status === 404) return clearTimeout(timeoutID);
|
||||||
return setTimeout(imgExpand.expand, 10000, thumb, url);
|
})
|
||||||
}
|
}, {
|
||||||
})
|
type: 'head'
|
||||||
}, {
|
});
|
||||||
type: 'head'
|
|
||||||
});
|
|
||||||
} else if (!g.dead) {
|
|
||||||
return setTimeout(imgExpand.expand, 10000, thumb, url);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var controls, form, imageType, select;
|
var controls, form, imageType, select;
|
||||||
|
|||||||
@ -2512,15 +2512,14 @@ imgExpand =
|
|||||||
if @src.split('/')[2] is 'images.4chan.org' and url = redirect.image src[3], src[5]
|
if @src.split('/')[2] is 'images.4chan.org' and url = redirect.image src[3], src[5]
|
||||||
setTimeout imgExpand.expand, 10000, thumb, url
|
setTimeout imgExpand.expand, 10000, thumb, url
|
||||||
return
|
return
|
||||||
|
return if g.dead
|
||||||
|
# CloudFlare may cache banned pages instead of images.
|
||||||
|
# This will fool CloudFlare's cache.
|
||||||
url = href + '?' + Date.now()
|
url = href + '?' + Date.now()
|
||||||
#navigator.online is not x-browser/os yet
|
#navigator.online is not x-browser/os yet
|
||||||
if engine is 'webkit'
|
timeoutID = setTimeout imgExpand.expand, 10000, thumb, url
|
||||||
req = $.ajax @src, onreadystatechange: (-> setTimeout imgExpand.expand, 10000, thumb, url if @status isnt 404),
|
$.ajax @src, onreadystatechange: (-> clearTimeout timeoutID if @status is 404),
|
||||||
type: 'head'
|
type: 'head'
|
||||||
#Firefox returns a status code of 0 because of the same origin policy
|
|
||||||
#Oprah doesn't send any request
|
|
||||||
else unless g.dead
|
|
||||||
setTimeout imgExpand.expand, 10000, thumb, url
|
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
controls = $.el 'div',
|
controls = $.el 'div',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user