Firefox returns status code 0 for cross domain requests, don't reload pictures only in 404'd threads.

Close #22
This commit is contained in:
Nicolas Stepien 2011-11-29 07:07:21 +01:00
parent 8a91a4e7fc
commit 0e076a1bcf
3 changed files with 7 additions and 4 deletions

View File

@ -2876,7 +2876,7 @@
img = $.el('img', {
src: a.href
});
if (engine === "gecko" && a.parentNode.className !== 'op') {
if (engine === 'gecko' && a.parentNode.className !== 'op') {
filesize = $('.filesize', a.parentNode);
_ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1];
img.style.maxWidth = "" + max + "px";
@ -2889,7 +2889,7 @@
var req, thumb;
thumb = this.previousSibling;
imgExpand.contract(thumb);
if (navigator.appName !== 'Opera') {
if (engine === 'webkit') {
req = $.ajax(this.src, null, 'head');
return req.onreadystatechange = function() {
if (this.status !== 404) {

View File

@ -2,6 +2,7 @@ master
- mayhem
new Indicate Duckrolls feature
put regex.info sauce back - disabled by default
fix for auto image reloading in 404'd threads on Firefox
2.21.4
- mayhem

View File

@ -2203,7 +2203,7 @@ imgExpand =
a = thumb.parentNode
img = $.el 'img',
src: a.href
if engine is "gecko" and a.parentNode.className isnt 'op'
if engine is 'gecko' and a.parentNode.className isnt 'op'
filesize = $ '.filesize', a.parentNode
[_, max] = filesize.textContent.match /(\d+)x/
img.style.maxWidth = "#{max}px"
@ -2215,9 +2215,11 @@ imgExpand =
thumb = @previousSibling
imgExpand.contract thumb
#navigator.online is not x-browser/os yet
if navigator.appName isnt 'Opera'
if engine is 'webkit'
req = $.ajax @src, null, 'head'
req.onreadystatechange = -> setTimeout imgExpand.retry, 10000, thumb if @status isnt 404
#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) ->