Merge branch 'master' of github.com:aeosynth/4chan-x
This commit is contained in:
commit
6f292f1dbd
@ -2537,10 +2537,10 @@
|
|||||||
var url;
|
var url;
|
||||||
switch (g.BOARD) {
|
switch (g.BOARD) {
|
||||||
case 'g':
|
case 'g':
|
||||||
|
case 'sci':
|
||||||
url = "http://archive.installgentoo.net/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID;
|
url = "http://archive.installgentoo.net/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID;
|
||||||
break;
|
break;
|
||||||
case 'lit':
|
case 'lit':
|
||||||
case 'sci':
|
|
||||||
case 'tv':
|
case 'tv':
|
||||||
url = "http://archive.gentoomen.org/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID;
|
url = "http://archive.gentoomen.org/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID;
|
||||||
break;
|
break;
|
||||||
@ -2655,7 +2655,7 @@
|
|||||||
a = thumb.parentNode;
|
a = thumb.parentNode;
|
||||||
$.bind(a, 'click', imgExpand.cb.toggle);
|
$.bind(a, 'click', imgExpand.cb.toggle);
|
||||||
if (imgExpand.on && root.className !== 'inline') {
|
if (imgExpand.on && root.className !== 'inline') {
|
||||||
return imgExpand.toggle(a);
|
return imgExpand.expand(a.firstChild);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cb: {
|
cb: {
|
||||||
@ -2667,21 +2667,22 @@
|
|||||||
return imgExpand.toggle(this);
|
return imgExpand.toggle(this);
|
||||||
},
|
},
|
||||||
all: function(e) {
|
all: function(e) {
|
||||||
var thumb, thumbs, _i, _j, _len, _len2, _results, _results2;
|
var thumb, _i, _j, _len, _len2, _ref, _ref2, _results, _results2;
|
||||||
thumbs = $$('img[md5]');
|
|
||||||
imgExpand.on = this.checked;
|
imgExpand.on = this.checked;
|
||||||
if (imgExpand.on) {
|
if (imgExpand.on) {
|
||||||
|
_ref = $$('img[md5]:not([hidden])');
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
thumb = thumbs[_i];
|
thumb = _ref[_i];
|
||||||
_results.push(!thumb.hidden ? imgExpand.expand(thumb) : void 0);
|
_results.push(imgExpand.expand(thumb));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
} else {
|
} else {
|
||||||
|
_ref2 = $$('img[md5][hidden]');
|
||||||
_results2 = [];
|
_results2 = [];
|
||||||
for (_j = 0, _len2 = thumbs.length; _j < _len2; _j++) {
|
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
||||||
thumb = thumbs[_j];
|
thumb = _ref2[_j];
|
||||||
_results2.push(thumb.hidden ? imgExpand.contract(thumb) : void 0);
|
_results2.push(imgExpand.contract(thumb));
|
||||||
}
|
}
|
||||||
return _results2;
|
return _results2;
|
||||||
}
|
}
|
||||||
@ -2719,7 +2720,6 @@
|
|||||||
},
|
},
|
||||||
expand: function(thumb) {
|
expand: function(thumb) {
|
||||||
var a, filesize, img, max, _, _ref;
|
var a, filesize, img, max, _, _ref;
|
||||||
thumb.hidden = true;
|
|
||||||
a = thumb.parentNode;
|
a = thumb.parentNode;
|
||||||
img = $.el('img', {
|
img = $.el('img', {
|
||||||
src: a.href
|
src: a.href
|
||||||
@ -2729,13 +2729,26 @@
|
|||||||
_ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1];
|
_ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1];
|
||||||
img.style.maxWidth = "-moz-calc(" + max + "px)";
|
img.style.maxWidth = "-moz-calc(" + max + "px)";
|
||||||
}
|
}
|
||||||
$.bind(img, 'error', function(e) {
|
$.bind(img, 'error', imgExpand.error);
|
||||||
thumb = this.previousSibling;
|
thumb.hidden = true;
|
||||||
imgExpand.contract(thumb);
|
|
||||||
return imgExpand.expand(thumb);
|
|
||||||
});
|
|
||||||
return $.add(a, img);
|
return $.add(a, img);
|
||||||
},
|
},
|
||||||
|
error: function(e) {
|
||||||
|
var req, thumb;
|
||||||
|
thumb = this.previousSibling;
|
||||||
|
imgExpand.contract(thumb);
|
||||||
|
req = $.ajax(this.src, null, 'head');
|
||||||
|
return req.onreadystatechange = function(e) {
|
||||||
|
if (this.status !== 404) {
|
||||||
|
return setTimeout(imgExpand.retry, 10000, thumb);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
retry: function(thumb) {
|
||||||
|
if (!thumb.hidden) {
|
||||||
|
return imgExpand.expand(thumb);
|
||||||
|
}
|
||||||
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var controls, delform, imageType, option, select, _i, _len, _ref;
|
var controls, delform, imageType, option, select, _i, _len, _ref;
|
||||||
controls = $.el('div', {
|
controls = $.el('div', {
|
||||||
@ -2760,7 +2773,7 @@
|
|||||||
return $.prepend(delform, controls);
|
return $.prepend(delform, controls);
|
||||||
},
|
},
|
||||||
resize: function(e) {
|
resize: function(e) {
|
||||||
return imgExpand.style.innerHTML = "body.fitheight img[md5] + img { max-height: " + d.body.clientHeight + "px }";
|
return imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:" + d.body.clientHeight + "px;}";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
firstRun = {
|
firstRun = {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ master
|
|||||||
- mayhem
|
- mayhem
|
||||||
initiate 4chan X earlier
|
initiate 4chan X earlier
|
||||||
automatically reload expanded pictures on error
|
automatically reload expanded pictures on error
|
||||||
|
update /sci/ archive redirection
|
||||||
|
|
||||||
2.20.1
|
2.20.1
|
||||||
- mayhem
|
- mayhem
|
||||||
|
|||||||
@ -1915,9 +1915,9 @@ Favicon =
|
|||||||
|
|
||||||
redirect = ->
|
redirect = ->
|
||||||
switch g.BOARD
|
switch g.BOARD
|
||||||
when 'g'
|
when 'g', 'sci'
|
||||||
url = "http://archive.installgentoo.net/cgi-board.pl/#{g.BOARD}/thread/#{g.THREAD_ID}"
|
url = "http://archive.installgentoo.net/cgi-board.pl/#{g.BOARD}/thread/#{g.THREAD_ID}"
|
||||||
when 'lit', 'sci', 'tv'
|
when 'lit', 'tv'
|
||||||
url = "http://archive.gentoomen.org/cgi-board.pl/#{g.BOARD}/thread/#{g.THREAD_ID}"
|
url = "http://archive.gentoomen.org/cgi-board.pl/#{g.BOARD}/thread/#{g.THREAD_ID}"
|
||||||
when 'a', 'jp', 'm', 'tg'
|
when 'a', 'jp', 'm', 'tg'
|
||||||
url = "http://archive.easymodo.net/#{g.BOARD}/thread/#{g.THREAD_ID}"
|
url = "http://archive.easymodo.net/#{g.BOARD}/thread/#{g.THREAD_ID}"
|
||||||
@ -1973,23 +1973,20 @@ imgExpand =
|
|||||||
return unless thumb = $ 'img[md5]', root
|
return unless thumb = $ 'img[md5]', root
|
||||||
a = thumb.parentNode
|
a = thumb.parentNode
|
||||||
$.bind a, 'click', imgExpand.cb.toggle
|
$.bind a, 'click', imgExpand.cb.toggle
|
||||||
if imgExpand.on and root.className isnt 'inline' then imgExpand.toggle a
|
if imgExpand.on and root.className isnt 'inline' then imgExpand.expand a.firstChild
|
||||||
cb:
|
cb:
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
|
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
imgExpand.toggle @
|
imgExpand.toggle @
|
||||||
all: (e) ->
|
all: (e) ->
|
||||||
thumbs = $$ 'img[md5]'
|
|
||||||
imgExpand.on = @checked
|
imgExpand.on = @checked
|
||||||
if imgExpand.on #expand
|
if imgExpand.on #expand
|
||||||
for thumb in thumbs
|
for thumb in $$ 'img[md5]:not([hidden])'
|
||||||
unless thumb.hidden #thumbnail hidden, image already expanded
|
imgExpand.expand thumb
|
||||||
imgExpand.expand thumb
|
|
||||||
else #contract
|
else #contract
|
||||||
for thumb in thumbs
|
for thumb in $$ 'img[md5][hidden]'
|
||||||
if thumb.hidden #thumbnail hidden - unhide it
|
imgExpand.contract thumb
|
||||||
imgExpand.contract thumb
|
|
||||||
typeChange: (e) ->
|
typeChange: (e) ->
|
||||||
switch @value
|
switch @value
|
||||||
when 'full'
|
when 'full'
|
||||||
@ -2014,7 +2011,6 @@ imgExpand =
|
|||||||
$.rm thumb.nextSibling
|
$.rm thumb.nextSibling
|
||||||
|
|
||||||
expand: (thumb) ->
|
expand: (thumb) ->
|
||||||
thumb.hidden = true
|
|
||||||
a = thumb.parentNode
|
a = thumb.parentNode
|
||||||
img = $.el 'img',
|
img = $.el 'img',
|
||||||
src: a.href
|
src: a.href
|
||||||
@ -2022,12 +2018,19 @@ imgExpand =
|
|||||||
filesize = $ 'span.filesize', a.parentNode
|
filesize = $ 'span.filesize', a.parentNode
|
||||||
[_, max] = filesize.textContent.match /(\d+)x/
|
[_, max] = filesize.textContent.match /(\d+)x/
|
||||||
img.style.maxWidth = "-moz-calc(#{max}px)"
|
img.style.maxWidth = "-moz-calc(#{max}px)"
|
||||||
$.bind img, 'error', (e) ->
|
$.bind img, 'error', imgExpand.error
|
||||||
thumb = @previousSibling
|
thumb.hidden = true
|
||||||
imgExpand.contract thumb
|
|
||||||
imgExpand.expand thumb
|
|
||||||
$.add a, img
|
$.add a, img
|
||||||
|
|
||||||
|
error: (e) ->
|
||||||
|
thumb = @previousSibling
|
||||||
|
imgExpand.contract thumb
|
||||||
|
#navigator.online is not x-browser/os yet
|
||||||
|
req = $.ajax @src, null, 'head'
|
||||||
|
req.onreadystatechange = (e) -> setTimeout imgExpand.retry, 10000, thumb if @status isnt 404
|
||||||
|
retry: (thumb) ->
|
||||||
|
imgExpand.expand thumb unless thumb.hidden
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
controls = $.el 'div',
|
controls = $.el 'div',
|
||||||
id: 'imgControls'
|
id: 'imgControls'
|
||||||
@ -2049,7 +2052,7 @@ imgExpand =
|
|||||||
$.prepend delform, controls
|
$.prepend delform, controls
|
||||||
|
|
||||||
resize: (e) ->
|
resize: (e) ->
|
||||||
imgExpand.style.innerHTML = "body.fitheight img[md5] + img { max-height: #{d.body.clientHeight}px }"
|
imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:#{d.body.clientHeight}px;}"
|
||||||
|
|
||||||
firstRun =
|
firstRun =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user