Use CSS instead of JS, bitches love CSS.

This commit is contained in:
Nicolas Stepien 2011-09-23 16:44:32 +02:00
parent a112ba332b
commit c14bd0a84c
2 changed files with 13 additions and 15 deletions

View File

@ -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;
} }

View File

@ -1980,16 +1980,13 @@ imgExpand =
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'