Merge branch 'master' of github.com:MayhemYDG/4chan-x into qr
Conflicts: 4chan_x.user.js script.coffee
This commit is contained in:
commit
91f7de90e5
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan x
|
// @name 4chan x
|
||||||
// @version 2.24.3
|
// @version 2.24.4
|
||||||
// @namespace aeosynth
|
// @namespace aeosynth
|
||||||
// @description Adds various features.
|
// @description Adds various features.
|
||||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
|
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||||
* http://mayhemydg.github.com/4chan-x/
|
* http://mayhemydg.github.com/4chan-x/
|
||||||
* 4chan X 2.24.3
|
* 4chan X 2.24.4
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person
|
* Permission is hereby granted, free of charge, to any person
|
||||||
* obtaining a copy of this software and associated documentation
|
* obtaining a copy of this software and associated documentation
|
||||||
@ -48,6 +48,8 @@
|
|||||||
*
|
*
|
||||||
* CONTRIBUTORS
|
* CONTRIBUTORS
|
||||||
*
|
*
|
||||||
|
* e000 - cooldown sanity check
|
||||||
|
* ahokadesuka - scroll back when unexpanding images
|
||||||
* Shou- - pentadactyl fixes
|
* Shou- - pentadactyl fixes
|
||||||
* ferongr - new favicons
|
* ferongr - new favicons
|
||||||
* xat- - new favicons
|
* xat- - new favicons
|
||||||
@ -199,7 +201,7 @@
|
|||||||
|
|
||||||
NAMESPACE = '4chan_x.';
|
NAMESPACE = '4chan_x.';
|
||||||
|
|
||||||
VERSION = '2.24.3';
|
VERSION = '2.24.4';
|
||||||
|
|
||||||
SECOND = 1000;
|
SECOND = 1000;
|
||||||
|
|
||||||
@ -2895,9 +2897,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function(a) {
|
toggle: function(a) {
|
||||||
var thumb;
|
var rect, thumb;
|
||||||
thumb = a.firstChild;
|
thumb = a.firstChild;
|
||||||
if (thumb.hidden) {
|
if (thumb.hidden) {
|
||||||
|
rect = a.parentNode.getBoundingClientRect();
|
||||||
|
if (rect.top < 0) d.body.scrollTop += rect.top;
|
||||||
|
if (rect.left < 0) d.body.scrollLeft += rect.left;
|
||||||
return imgExpand.contract(thumb);
|
return imgExpand.contract(thumb);
|
||||||
} else {
|
} else {
|
||||||
return imgExpand.expand(thumb);
|
return imgExpand.expand(thumb);
|
||||||
@ -2909,9 +2914,10 @@
|
|||||||
},
|
},
|
||||||
expand: function(thumb, url) {
|
expand: function(thumb, url) {
|
||||||
var a, filesize, img, max;
|
var a, filesize, img, max;
|
||||||
|
if (thumb.hidden) return;
|
||||||
a = thumb.parentNode;
|
a = thumb.parentNode;
|
||||||
img = $.el('img', {
|
img = $.el('img', {
|
||||||
src: url ? url : a.href
|
src: url || a.href
|
||||||
});
|
});
|
||||||
if (engine === 'gecko' && a.parentNode.className !== 'op') {
|
if (engine === 'gecko' && a.parentNode.className !== 'op') {
|
||||||
filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent;
|
filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent;
|
||||||
@ -2923,28 +2929,29 @@
|
|||||||
return $.add(a, img);
|
return $.add(a, img);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
var req, src, thumb, url;
|
var href, req, src, thumb, url;
|
||||||
|
href = this.parentNode.href;
|
||||||
thumb = this.previousSibling;
|
thumb = this.previousSibling;
|
||||||
imgExpand.contract(thumb);
|
imgExpand.contract(thumb);
|
||||||
src = this.src.split('/');
|
src = href.split('/');
|
||||||
if (url = redirect.image(src[3], src[5])) {
|
if (this.src.split('/')[2] === 'images.4chan.org' && (url = redirect.image(src[3], src[5]))) {
|
||||||
return imgExpand.expand(thumb, url);
|
setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||||
} else if (engine === 'webkit') {
|
return;
|
||||||
|
}
|
||||||
|
url = href + '?' + Date.now();
|
||||||
|
if (engine === 'webkit') {
|
||||||
return req = $.ajax(this.src, (function() {
|
return req = $.ajax(this.src, (function() {
|
||||||
if (this.status !== 404) {
|
if (this.status !== 404) {
|
||||||
return setTimeout(imgExpand.retry, 10000, thumb);
|
return setTimeout(imgExpand.expand, 10000, thumb, url);
|
||||||
}
|
}
|
||||||
}), {
|
}), {
|
||||||
type: 'head',
|
type: 'head',
|
||||||
event: 'onreadystatechange'
|
event: 'onreadystatechange'
|
||||||
});
|
});
|
||||||
} else if (!g.dead) {
|
} 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() {
|
dialog: function() {
|
||||||
var controls, form, imageType, select;
|
var controls, form, imageType, select;
|
||||||
controls = $.el('div', {
|
controls = $.el('div', {
|
||||||
|
|||||||
4
Cakefile
4
Cakefile
@ -2,7 +2,7 @@
|
|||||||
{exec} = require 'child_process'
|
{exec} = require 'child_process'
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
|
|
||||||
VERSION = '2.24.3'
|
VERSION = '2.24.4'
|
||||||
|
|
||||||
HEADER = """
|
HEADER = """
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
@ -55,6 +55,8 @@ HEADER = """
|
|||||||
*
|
*
|
||||||
* CONTRIBUTORS
|
* CONTRIBUTORS
|
||||||
*
|
*
|
||||||
|
* e000 - cooldown sanity check
|
||||||
|
* ahokadesuka - scroll back when unexpanding images
|
||||||
* Shou- - pentadactyl fixes
|
* Shou- - pentadactyl fixes
|
||||||
* ferongr - new favicons
|
* ferongr - new favicons
|
||||||
* xat- - new favicons
|
* xat- - new favicons
|
||||||
|
|||||||
@ -1,5 +1,13 @@
|
|||||||
master
|
master
|
||||||
|
|
||||||
|
2.24.4
|
||||||
|
- ahokadesuka
|
||||||
|
Scroll back up when unexpanding images.
|
||||||
|
- e000
|
||||||
|
Prevent absurd cooldown durations.
|
||||||
|
- Mayhem
|
||||||
|
Better image expanding reload, should fool CloudFlare's cache.
|
||||||
|
|
||||||
2.24.3
|
2.24.3
|
||||||
- Mayhem
|
- Mayhem
|
||||||
Set image limit in Thread Stats to 252 for /a/ and /v/, default to 152.
|
Set image limit in Thread Stats to 252 for /a/ and /v/, default to 152.
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
postMessage({version:'2.24.3'},'*');
|
postMessage({version:'2.24.4'},'*');
|
||||||
|
|||||||
@ -121,7 +121,7 @@ conf = {}
|
|||||||
) null, config
|
) null, config
|
||||||
|
|
||||||
NAMESPACE = '4chan_x.'
|
NAMESPACE = '4chan_x.'
|
||||||
VERSION = '2.24.3'
|
VERSION = '2.24.4'
|
||||||
SECOND = 1000
|
SECOND = 1000
|
||||||
MINUTE = 60*SECOND
|
MINUTE = 60*SECOND
|
||||||
HOUR = 60*MINUTE
|
HOUR = 60*MINUTE
|
||||||
@ -2213,6 +2213,9 @@ imgExpand =
|
|||||||
toggle: (a) ->
|
toggle: (a) ->
|
||||||
thumb = a.firstChild
|
thumb = a.firstChild
|
||||||
if thumb.hidden
|
if thumb.hidden
|
||||||
|
rect = a.parentNode.getBoundingClientRect()
|
||||||
|
d.body.scrollTop += rect.top if rect.top < 0
|
||||||
|
d.body.scrollLeft += rect.left if rect.left < 0
|
||||||
imgExpand.contract thumb
|
imgExpand.contract thumb
|
||||||
else
|
else
|
||||||
imgExpand.expand thumb
|
imgExpand.expand thumb
|
||||||
@ -2222,9 +2225,10 @@ imgExpand =
|
|||||||
$.rm thumb.nextSibling
|
$.rm thumb.nextSibling
|
||||||
|
|
||||||
expand: (thumb, url) ->
|
expand: (thumb, url) ->
|
||||||
|
return if thumb.hidden
|
||||||
a = thumb.parentNode
|
a = thumb.parentNode
|
||||||
img = $.el 'img',
|
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'
|
if engine is 'gecko' and a.parentNode.className isnt 'op'
|
||||||
filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent
|
filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent
|
||||||
max = filesize.match /(\d+)x/
|
max = filesize.match /(\d+)x/
|
||||||
@ -2234,22 +2238,23 @@ imgExpand =
|
|||||||
$.add a, img
|
$.add a, img
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
|
href = @parentNode.href
|
||||||
thumb = @previousSibling
|
thumb = @previousSibling
|
||||||
imgExpand.contract thumb
|
imgExpand.contract thumb
|
||||||
src = @src.split '/'
|
src = href.split '/'
|
||||||
if url = redirect.image src[3], src[5]
|
if @src.split('/')[2] is 'images.4chan.org' and url = redirect.image src[3], src[5]
|
||||||
imgExpand.expand thumb, url
|
setTimeout imgExpand.expand, 10000, thumb, url
|
||||||
|
return
|
||||||
|
url = href + '?' + Date.now()
|
||||||
#navigator.online is not x-browser/os yet
|
#navigator.online is not x-browser/os yet
|
||||||
else if engine is 'webkit'
|
if engine is 'webkit'
|
||||||
req = $.ajax @src, (->
|
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'
|
), type: 'head', event: 'onreadystatechange'
|
||||||
#Firefox returns a status code of 0 because of the same origin policy
|
#Firefox returns a status code of 0 because of the same origin policy
|
||||||
#Oprah doesn't send any request
|
#Oprah doesn't send any request
|
||||||
else unless g.dead
|
else unless g.dead
|
||||||
setTimeout imgExpand.retry, 10000, thumb
|
setTimeout imgExpand.expand, 10000, thumb, url
|
||||||
retry: (thumb) ->
|
|
||||||
imgExpand.expand thumb unless thumb.hidden
|
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
controls = $.el 'div',
|
controls = $.el 'div',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user