diff --git a/4chan_x.user.js b/4chan_x.user.js index d4edfc025..4b78c72ad 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4160,10 +4160,13 @@ } url = "//images.4chan.org/" + src[3] + "/src/" + src[5] + "?" + (Date.now()); } + if ($.engine !== 'webkit' && url.split('/')[2] === 'images.4chan.org') { + return; + } timeoutID = setTimeout((function() { return _this.src = url; }), 3000); - if (!($.engine === 'webkit' && src[2] === 'images.4chan.org')) { + if ($.engine !== 'webkit' || url.split('/')[2] !== 'images.4chan.org') { return; } return $.ajax(url, { @@ -4345,8 +4348,11 @@ } url = "//images.4chan.org/" + src[3] + "/src/" + src[5] + "?" + (Date.now()); } + if ($.engine !== 'webkit' && url.split('/')[2] === 'images.4chan.org') { + return; + } timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url); - if (!($.engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) { + if ($.engine !== 'webkit' || url.split('/')[2] !== 'images.4chan.org') { return; } return $.ajax(url, { diff --git a/script.coffee b/script.coffee index 72085076b..8d6bd53c1 100644 --- a/script.coffee +++ b/script.coffee @@ -3228,14 +3228,13 @@ ImageHover = src = @src.replace(/\?\d+$/, '').split '/' unless src[2] is 'images.4chan.org' and url = Redirect.image src[3], src[5] return if g.dead - # CloudFlare may cache banned pages instead of images. # This will fool CloudFlare's cache. url = "//images.4chan.org/#{src[3]}/src/#{src[5]}?#{Date.now()}" - # navigator.online is not x-browser/os yet + return if $.engine isnt 'webkit' and url.split('/')[2] is 'images.4chan.org' timeoutID = setTimeout (=> @src = url), 3000 - # Only Chrome let userscript break through cross domain requests. - # Don't check it 404s in the archivers. - return unless $.engine is 'webkit' and src[2] is 'images.4chan.org' + # Only Chrome let userscripts do cross domain requests. + # Don't check for 404'd status in the archivers. + return if $.engine isnt 'webkit' or url.split('/')[2] isnt 'images.4chan.org' $.ajax url, onreadystatechange: (-> clearTimeout timeoutID if @status is 404), type: 'head' mouseout: -> @@ -3349,14 +3348,13 @@ ImageExpand = src = @src.replace(/\?\d+$/, '').split '/' unless src[2] is 'images.4chan.org' and url = Redirect.image src[3], src[5] return if g.dead - # CloudFlare may cache banned pages instead of images. # This will fool CloudFlare's cache. url = "//images.4chan.org/#{src[3]}/src/#{src[5]}?#{Date.now()}" - #navigator.online is not x-browser/os yet + return if $.engine isnt 'webkit' and url.split('/')[2] is 'images.4chan.org' timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url - # Only Chrome let userscript break through cross domain requests. - # Don't check it 404s in the archivers. - return unless $.engine is 'webkit' and url.split('/')[2] is 'images.4chan.org' + # Only Chrome let userscripts do cross domain requests. + # Don't check for 404'd status in the archivers. + return if $.engine isnt 'webkit' or url.split('/')[2] isnt 'images.4chan.org' $.ajax url, onreadystatechange: (-> clearTimeout timeoutID if @status is 404), type: 'head'