From c14bd0a84c88e61e808e61e27ac6fadc801d8f15 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 23 Sep 2011 16:44:32 +0200 Subject: [PATCH] Use CSS instead of JS, bitches love CSS. --- 4chan_x.user.js | 17 +++++++++-------- script.coffee | 11 ++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index f29f41906..62653deeb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -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; } diff --git a/script.coffee b/script.coffee index 192a7f29d..a30796844 100644 --- a/script.coffee +++ b/script.coffee @@ -1980,16 +1980,13 @@ imgExpand = 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'