Fool the browser cache and CloudFlare's cache when trying to reload a picture from 4chan.
This commit is contained in:
parent
0ccacc490f
commit
25276b5aac
@ -3005,9 +3005,10 @@
|
||||
},
|
||||
expand: function(thumb, url) {
|
||||
var a, filesize, img, max;
|
||||
if (thumb.hidden) return;
|
||||
a = thumb.parentNode;
|
||||
img = $.el('img', {
|
||||
src: url ? url : a.href
|
||||
src: url || a.href
|
||||
});
|
||||
if (engine === 'gecko' && a.parentNode.className !== 'op') {
|
||||
filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent;
|
||||
@ -3019,28 +3020,29 @@
|
||||
return $.add(a, img);
|
||||
},
|
||||
error: function() {
|
||||
var req, src, thumb, url;
|
||||
var href, req, src, thumb, url;
|
||||
href = this.parentNode.href;
|
||||
thumb = this.previousSibling;
|
||||
imgExpand.contract(thumb);
|
||||
src = this.src.split('/');
|
||||
src = href.split('/');
|
||||
if (src[2] === 'images.4chan.org' && (url = redirect.image(src[3], src[5]))) {
|
||||
return setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||
} else if (engine === 'webkit') {
|
||||
setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||
return;
|
||||
}
|
||||
url = href + '?' + Date.now();
|
||||
if (engine === 'webkit') {
|
||||
return req = $.ajax(this.src, (function() {
|
||||
if (this.status !== 404) {
|
||||
return setTimeout(imgExpand.retry, 10000, thumb);
|
||||
return setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||
}
|
||||
}), {
|
||||
type: 'head',
|
||||
event: 'onreadystatechange'
|
||||
});
|
||||
} else if (!g.dead) {
|
||||
return setTimeout(imgExpand.retry, 10000, thumb);
|
||||
return setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||
}
|
||||
},
|
||||
retry: function(thumb) {
|
||||
if (!thumb.hidden) return imgExpand.expand(thumb);
|
||||
},
|
||||
dialog: function() {
|
||||
var controls, form, imageType, select;
|
||||
controls = $.el('div', {
|
||||
|
||||
@ -2325,9 +2325,10 @@ imgExpand =
|
||||
$.rm thumb.nextSibling
|
||||
|
||||
expand: (thumb, url) ->
|
||||
return if thumb.hidden
|
||||
a = thumb.parentNode
|
||||
img = $.el 'img',
|
||||
src: if url then url else a.href
|
||||
src: url or a.href
|
||||
if engine is 'gecko' and a.parentNode.className isnt 'op'
|
||||
filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent
|
||||
max = filesize.match /(\d+)x/
|
||||
@ -2337,22 +2338,23 @@ imgExpand =
|
||||
$.add a, img
|
||||
|
||||
error: ->
|
||||
href = @parentNode.href
|
||||
thumb = @previousSibling
|
||||
imgExpand.contract thumb
|
||||
src = @src.split '/'
|
||||
src = href.split '/'
|
||||
if src[2] is 'images.4chan.org' and url = redirect.image src[3], src[5]
|
||||
setTimeout imgExpand.expand, 10000, thumb, url
|
||||
return
|
||||
url = href + '?' + Date.now()
|
||||
#navigator.online is not x-browser/os yet
|
||||
else if engine is 'webkit'
|
||||
if engine is 'webkit'
|
||||
req = $.ajax @src, (->
|
||||
setTimeout imgExpand.retry, 10000, thumb if @status isnt 404
|
||||
setTimeout imgExpand.expand, 10000, thumb, url if @status isnt 404
|
||||
), type: 'head', event: 'onreadystatechange'
|
||||
#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.retry, 10000, thumb
|
||||
retry: (thumb) ->
|
||||
imgExpand.expand thumb unless thumb.hidden
|
||||
setTimeout imgExpand.expand, 10000, thumb, url
|
||||
|
||||
dialog: ->
|
||||
controls = $.el 'div',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user