From 6cc89ab68d65d2e7b553e5e695ccee7758bbd006 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 7 May 2011 23:30:27 -0700 Subject: [PATCH] fix image expansion bug wtf did this come from? --- 4chan_x.js | 11 ++++++----- script.coffee | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index e35c626ba..fe272461e 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1993,13 +1993,14 @@ }, cb: { node: function(root) { - var thumb, _i, _len, _ref2, _results; + var a, thumb, _i, _len, _ref2, _results; _ref2 = $$('img[md5]', root); _results = []; for (_i = 0, _len = _ref2.length; _i < _len; _i++) { thumb = _ref2[_i]; - $.bind(thumb.parentNode, 'click', imgExpand.cb.toggle); - _results.push(imgExpand.on ? imgExpand.toggle(thumb) : void 0); + a = thumb.parentNode; + $.bind(a, 'click', imgExpand.cb.toggle); + _results.push(imgExpand.on ? imgExpand.toggle(a) : void 0); } return _results; }, @@ -2043,9 +2044,9 @@ return _results; } }, - toggle: function(img) { + toggle: function(a) { var thumb; - thumb = img.parentNode.firstChild; + thumb = a.firstChild; imgExpand.foo(); if (thumb.style.display) { return imgExpand.contract(thumb); diff --git a/script.coffee b/script.coffee index 7688407d8..bf083257a 100644 --- a/script.coffee +++ b/script.coffee @@ -1539,8 +1539,9 @@ imgExpand = cb: node: (root) -> for thumb in $$ 'img[md5]', root - $.bind thumb.parentNode, 'click', imgExpand.cb.toggle - if imgExpand.on then imgExpand.toggle thumb + a = thumb.parentNode + $.bind a, 'click', imgExpand.cb.toggle + if imgExpand.on then imgExpand.toggle a toggle: (e) -> return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0 e.preventDefault() @@ -1562,8 +1563,8 @@ imgExpand = for img in $$ 'img[md5] + img' imgExpand.resize img - toggle: (img) -> - thumb = img.parentNode.firstChild + toggle: (a) -> + thumb = a.firstChild imgExpand.foo() if thumb.style.display imgExpand.contract thumb