Merge branch 'master' of github.com:aeosynth/4chan-x

This commit is contained in:
James Campos 2011-09-24 14:09:59 -07:00
commit 6f292f1dbd
3 changed files with 50 additions and 33 deletions

View File

@ -2537,10 +2537,10 @@
var url;
switch (g.BOARD) {
case 'g':
case 'sci':
url = "http://archive.installgentoo.net/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID;
break;
case 'lit':
case 'sci':
case 'tv':
url = "http://archive.gentoomen.org/cgi-board.pl/" + g.BOARD + "/thread/" + g.THREAD_ID;
break;
@ -2655,7 +2655,7 @@
a = thumb.parentNode;
$.bind(a, 'click', imgExpand.cb.toggle);
if (imgExpand.on && root.className !== 'inline') {
return imgExpand.toggle(a);
return imgExpand.expand(a.firstChild);
}
},
cb: {
@ -2667,21 +2667,22 @@
return imgExpand.toggle(this);
},
all: function(e) {
var thumb, thumbs, _i, _j, _len, _len2, _results, _results2;
thumbs = $$('img[md5]');
var thumb, _i, _j, _len, _len2, _ref, _ref2, _results, _results2;
imgExpand.on = this.checked;
if (imgExpand.on) {
_ref = $$('img[md5]:not([hidden])');
_results = [];
for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
thumb = thumbs[_i];
_results.push(!thumb.hidden ? imgExpand.expand(thumb) : void 0);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
thumb = _ref[_i];
_results.push(imgExpand.expand(thumb));
}
return _results;
} else {
_ref2 = $$('img[md5][hidden]');
_results2 = [];
for (_j = 0, _len2 = thumbs.length; _j < _len2; _j++) {
thumb = thumbs[_j];
_results2.push(thumb.hidden ? imgExpand.contract(thumb) : void 0);
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
thumb = _ref2[_j];
_results2.push(imgExpand.contract(thumb));
}
return _results2;
}
@ -2719,7 +2720,6 @@
},
expand: function(thumb) {
var a, filesize, img, max, _, _ref;
thumb.hidden = true;
a = thumb.parentNode;
img = $.el('img', {
src: a.href
@ -2729,13 +2729,26 @@
_ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1];
img.style.maxWidth = "-moz-calc(" + max + "px)";
}
$.bind(img, 'error', function(e) {
thumb = this.previousSibling;
imgExpand.contract(thumb);
return imgExpand.expand(thumb);
});
$.bind(img, 'error', imgExpand.error);
thumb.hidden = true;
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() {
var controls, delform, imageType, option, select, _i, _len, _ref;
controls = $.el('div', {
@ -2760,7 +2773,7 @@
return $.prepend(delform, controls);
},
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 = {

View File

@ -2,6 +2,7 @@ master
- mayhem
initiate 4chan X earlier
automatically reload expanded pictures on error
update /sci/ archive redirection
2.20.1
- mayhem

View File

@ -1915,9 +1915,9 @@ Favicon =
redirect = ->
switch g.BOARD
when 'g'
when 'g', 'sci'
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}"
when 'a', 'jp', 'm', 'tg'
url = "http://archive.easymodo.net/#{g.BOARD}/thread/#{g.THREAD_ID}"
@ -1973,23 +1973,20 @@ imgExpand =
return unless thumb = $ 'img[md5]', root
a = thumb.parentNode
$.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:
toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
e.preventDefault()
imgExpand.toggle @
all: (e) ->
thumbs = $$ 'img[md5]'
imgExpand.on = @checked
if imgExpand.on #expand
for thumb in thumbs
unless thumb.hidden #thumbnail hidden, image already expanded
imgExpand.expand thumb
for thumb in $$ 'img[md5]:not([hidden])'
imgExpand.expand thumb
else #contract
for thumb in thumbs
if thumb.hidden #thumbnail hidden - unhide it
imgExpand.contract thumb
for thumb in $$ 'img[md5][hidden]'
imgExpand.contract thumb
typeChange: (e) ->
switch @value
when 'full'
@ -2014,7 +2011,6 @@ imgExpand =
$.rm thumb.nextSibling
expand: (thumb) ->
thumb.hidden = true
a = thumb.parentNode
img = $.el 'img',
src: a.href
@ -2022,12 +2018,19 @@ imgExpand =
filesize = $ 'span.filesize', a.parentNode
[_, max] = filesize.textContent.match /(\d+)x/
img.style.maxWidth = "-moz-calc(#{max}px)"
$.bind img, 'error', (e) ->
thumb = @previousSibling
imgExpand.contract thumb
imgExpand.expand thumb
$.bind img, 'error', imgExpand.error
thumb.hidden = true
$.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: ->
controls = $.el 'div',
id: 'imgControls'
@ -2049,7 +2052,7 @@ imgExpand =
$.prepend delform, controls
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 =
init: ->