fix image stuff

This commit is contained in:
James Campos 2011-04-19 23:48:33 -07:00
parent 80defac720
commit 8977f055cc
2 changed files with 20 additions and 19 deletions

View File

@ -674,14 +674,13 @@
}
},
img: function(thread, all) {
var image;
var root, thumb;
if (all) {
return $("#imageExpand").click();
} else {
if (!(image = $('td.replyhl span.filesize ~ a[target]', thread))) {
image = $('span.filesize ~ a[target]', thread);
}
return imageToggle(image);
root = $('td.replyhl', thread) || thread;
thumb = $('img[md5]', root);
return imgExpand.toggle(thumb);
}
},
qr: function(thread, quote) {
@ -1898,25 +1897,26 @@
return _results;
}
},
toggle: function(a) {
toggle: function(img) {
var ch, cw, imageType, thumb;
thumb = a.firstChild;
thumb = img.parentNode.firstChild;
cw = d.body.clientWidth;
ch = d.body.clientHeight;
imageType = $("#imageType").value;
if (thumb.style.display) {
return imgExpand.contract(a);
return imgExpand.contract(thumb);
} else {
return imgExpand.expand(thumb, cw, ch, imageType, a);
return imgExpand.expand(thumb, cw, ch, imageType);
}
},
contract: function(thumb) {
$.show(thumb);
return $.remove(thumb.nextSibling);
},
expand: function(thumb, cw, ch, imageType, a) {
var img;
expand: function(thumb, cw, ch, imageType) {
var a, img;
$.hide(thumb);
a = thumb.parentNode;
img = $.el('img', {
src: a.href
});

View File

@ -490,9 +490,9 @@ keybinds =
if all
$("#imageExpand").click()
else
unless image = $ 'td.replyhl span.filesize ~ a[target]', thread
image = $ 'span.filesize ~ a[target]', thread
imageToggle image
root = $('td.replyhl', thread) or thread
thumb = $ 'img[md5]', root
imgExpand.toggle thumb
qr: (thread, quote) ->
unless qrLink = $ 'td.replyhl span[id] a:not(:first-child)', thread
@ -1434,22 +1434,23 @@ imgExpand =
for img in $$ 'img[md5] + img'
imgExpand.resize cw, ch, imageType, img
toggle: (a) ->
thumb = a.firstChild
toggle: (img) ->
thumb = img.parentNode.firstChild
cw = d.body.clientWidth
ch = d.body.clientHeight
imageType = $("#imageType").value
if thumb.style.display
imgExpand.contract a
imgExpand.contract thumb
else
imgExpand.expand thumb, cw, ch, imageType, a
imgExpand.expand thumb, cw, ch, imageType
contract: (thumb) ->
$.show thumb
$.remove thumb.nextSibling
expand: (thumb, cw, ch, imageType, a) ->
expand: (thumb, cw, ch, imageType) ->
$.hide thumb
a = thumb.parentNode
img = $.el 'img',
src: a.href
a.appendChild img