Fix #517
This commit is contained in:
parent
55a036708e
commit
daac7ce5ee
@ -3620,12 +3620,11 @@
|
|||||||
return location.href = url;
|
return location.href = url;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
image: function(href) {
|
image: function(board, filename) {
|
||||||
href = href.split('/');
|
|
||||||
if (!Conf['404 Redirect']) {
|
if (!Conf['404 Redirect']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (href[3]) {
|
switch (board) {
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'co':
|
case 'co':
|
||||||
case 'jp':
|
case 'jp':
|
||||||
@ -3633,7 +3632,7 @@
|
|||||||
case 'tg':
|
case 'tg':
|
||||||
case 'u':
|
case 'u':
|
||||||
case 'vg':
|
case 'vg':
|
||||||
return "http://archive.foolz.us/" + href[3] + "/full_image/" + href[5];
|
return "http://archive.foolz.us/" + board + "/full_image/" + filename;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
thread: function(board, id, mode) {
|
thread: function(board, id, mode) {
|
||||||
@ -3712,6 +3711,7 @@
|
|||||||
});
|
});
|
||||||
$.add(d.body, el);
|
$.add(d.body, el);
|
||||||
$.on(el, 'load', ImageHover.load);
|
$.on(el, 'load', ImageHover.load);
|
||||||
|
$.on(el, 'error', ImageHover.error);
|
||||||
$.on(this, 'mousemove', UI.hover);
|
$.on(this, 'mousemove', UI.hover);
|
||||||
return $.on(this, 'mouseout', ImageHover.mouseout);
|
return $.on(this, 'mouseout', ImageHover.mouseout);
|
||||||
},
|
},
|
||||||
@ -3726,6 +3726,32 @@
|
|||||||
clientY: 120 + parseInt(style.top)
|
clientY: 120 + parseInt(style.top)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
error: function() {
|
||||||
|
var src, timeoutID, url,
|
||||||
|
_this = this;
|
||||||
|
src = this.src.replace(/\?\d+$/, '').split('/');
|
||||||
|
if (!(src[2] === 'images.4chan.org' && (url = Redirect.image(src[3], src[5])))) {
|
||||||
|
if (g.dead) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
url = "//images.4chan.org/" + src[3] + "/src/" + src[5] + "?" + (Date.now());
|
||||||
|
}
|
||||||
|
timeoutID = setTimeout((function() {
|
||||||
|
return _this.src = url;
|
||||||
|
}), 3000);
|
||||||
|
if (!($.engine === 'webkit' && src[2] === 'images.4chan.org')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return $.ajax(url, {
|
||||||
|
onreadystatechange: (function() {
|
||||||
|
if (this.status === 404) {
|
||||||
|
return clearTimeout(timeoutID);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, {
|
||||||
|
type: 'head'
|
||||||
|
});
|
||||||
|
},
|
||||||
mouseout: function() {
|
mouseout: function() {
|
||||||
UI.hoverend();
|
UI.hoverend();
|
||||||
$.off(this, 'mousemove', UI.hover);
|
$.off(this, 'mousemove', UI.hover);
|
||||||
@ -3883,16 +3909,16 @@
|
|||||||
return $.add(a, img);
|
return $.add(a, img);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
var href, thumb, timeoutID, url;
|
var src, thumb, timeoutID, url;
|
||||||
href = this.parentNode.href;
|
|
||||||
thumb = this.previousSibling;
|
thumb = this.previousSibling;
|
||||||
ImageExpand.contract(thumb);
|
ImageExpand.contract(thumb);
|
||||||
$.rm(this);
|
$.rm(this);
|
||||||
if (!(this.src.split('/')[2] === 'images.4chan.org' && (url = Redirect.image(href)))) {
|
src = this.src.replace(/\?\d+$/, '').split('/');
|
||||||
|
if (!(src[2] === 'images.4chan.org' && (url = Redirect.image(src[3], src[5])))) {
|
||||||
if (g.dead) {
|
if (g.dead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
url = href + '?' + Date.now();
|
url = "//images.4chan.org/" + src[3] + "/src/" + src[5] + "?" + (Date.now());
|
||||||
}
|
}
|
||||||
timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url);
|
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')) {
|
||||||
|
|||||||
@ -2767,13 +2767,12 @@ Redirect =
|
|||||||
else if /^\d+$/.test g.THREAD_ID
|
else if /^\d+$/.test g.THREAD_ID
|
||||||
@thread()
|
@thread()
|
||||||
location.href = url if url
|
location.href = url if url
|
||||||
image: (href) ->
|
image: (board, filename) ->
|
||||||
href = href.split '/'
|
|
||||||
# Do not use g.BOARD, the image url can originate from a cross-quote.
|
# Do not use g.BOARD, the image url can originate from a cross-quote.
|
||||||
return unless Conf['404 Redirect']
|
return unless Conf['404 Redirect']
|
||||||
switch href[3]
|
switch board
|
||||||
when 'a', 'co', 'jp', 'm', 'tg', 'u', 'vg'
|
when 'a', 'co', 'jp', 'm', 'tg', 'u', 'vg'
|
||||||
"http://archive.foolz.us/#{href[3]}/full_image/#{href[5]}"
|
"http://archive.foolz.us/#{board}/full_image/#{filename}"
|
||||||
thread: (board=g.BOARD, id=g.THREAD_ID, mode='thread') ->
|
thread: (board=g.BOARD, id=g.THREAD_ID, mode='thread') ->
|
||||||
return unless Conf['404 Redirect'] or mode is 'post'
|
return unless Conf['404 Redirect'] or mode is 'post'
|
||||||
switch board
|
switch board
|
||||||
@ -2817,6 +2816,7 @@ ImageHover =
|
|||||||
src: @parentNode.href
|
src: @parentNode.href
|
||||||
$.add d.body, el
|
$.add d.body, el
|
||||||
$.on el, 'load', ImageHover.load
|
$.on el, 'load', ImageHover.load
|
||||||
|
$.on el, 'error', ImageHover.error
|
||||||
$.on @, 'mousemove', UI.hover
|
$.on @, 'mousemove', UI.hover
|
||||||
$.on @, 'mouseout', ImageHover.mouseout
|
$.on @, 'mouseout', ImageHover.mouseout
|
||||||
load: ->
|
load: ->
|
||||||
@ -2826,6 +2826,20 @@ ImageHover =
|
|||||||
UI.hover
|
UI.hover
|
||||||
clientX: - 45 + parseInt style.left
|
clientX: - 45 + parseInt style.left
|
||||||
clientY: 120 + parseInt style.top
|
clientY: 120 + parseInt style.top
|
||||||
|
error: ->
|
||||||
|
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
|
||||||
|
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'
|
||||||
|
$.ajax url, onreadystatechange: (-> clearTimeout timeoutID if @status is 404),
|
||||||
|
type: 'head'
|
||||||
mouseout: ->
|
mouseout: ->
|
||||||
UI.hoverend()
|
UI.hoverend()
|
||||||
$.off @, 'mousemove', UI.hover
|
$.off @, 'mousemove', UI.hover
|
||||||
@ -2931,15 +2945,15 @@ ImageExpand =
|
|||||||
$.add a, img
|
$.add a, img
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
href = @parentNode.href
|
|
||||||
thumb = @previousSibling
|
thumb = @previousSibling
|
||||||
ImageExpand.contract thumb
|
ImageExpand.contract thumb
|
||||||
$.rm @
|
$.rm @
|
||||||
unless @src.split('/')[2] is 'images.4chan.org' and url = Redirect.image href
|
src = @src.replace(/\?\d+$/, '').split '/'
|
||||||
|
unless src[2] is 'images.4chan.org' and url = Redirect.image src[3], src[5]
|
||||||
return if g.dead
|
return if g.dead
|
||||||
# CloudFlare may cache banned pages instead of images.
|
# CloudFlare may cache banned pages instead of images.
|
||||||
# This will fool CloudFlare's cache.
|
# This will fool CloudFlare's cache.
|
||||||
url = href + '?' + Date.now()
|
url = "//images.4chan.org/#{src[3]}/src/#{src[5]}?#{Date.now()}"
|
||||||
#navigator.online is not x-browser/os yet
|
#navigator.online is not x-browser/os yet
|
||||||
timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url
|
timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url
|
||||||
# Only Chrome let userscript break through cross domain requests.
|
# Only Chrome let userscript break through cross domain requests.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user