diff --git a/4chan_x.user.js b/4chan_x.user.js index 6086007d7..7bd456da4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2700,7 +2700,7 @@ init: function() { return g.callbacks.push(function(root) { var src, thumb; - if (!(thumb = $('img[md5]', root))) return; + if (root.hidden || !(thumb = $('img[md5]', root))) return; src = thumb.parentNode.href; if (/gif$/.test(src)) return thumb.src = src; }); @@ -2717,7 +2717,7 @@ if (!(thumb = $('img[md5]', root))) return; a = thumb.parentNode; $.on(a, 'click', imgExpand.cb.toggle); - if (imgExpand.on && root.className !== 'inline') { + if (imgExpand.on && !root.hidden && root.className !== 'inline') { return imgExpand.expand(a.firstChild); } }, @@ -2731,7 +2731,7 @@ var thumb, _i, _j, _len, _len2, _ref, _ref2, _results, _results2; imgExpand.on = this.checked; if (imgExpand.on) { - _ref = $$('img[md5]:not([hidden])'); + _ref = $$('.op > a > img[md5]:last-child, table:not([hidden]) img[md5]:last-child'); _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { thumb = _ref[_i]; diff --git a/script.coffee b/script.coffee index 7865745be..3b6373b1b 100644 --- a/script.coffee +++ b/script.coffee @@ -2054,7 +2054,7 @@ imgHover = imgGif = init: -> g.callbacks.push (root) -> - return unless thumb = $ 'img[md5]', root + return if root.hidden or !thumb = $ 'img[md5]', root src = thumb.parentNode.href if /gif$/.test src thumb.src = src @@ -2068,7 +2068,8 @@ imgExpand = return unless thumb = $ 'img[md5]', root a = thumb.parentNode $.on a, 'click', imgExpand.cb.toggle - if imgExpand.on and root.className isnt 'inline' then imgExpand.expand a.firstChild + if imgExpand.on and !root.hidden and root.className isnt 'inline' + imgExpand.expand a.firstChild cb: toggle: (e) -> return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0 @@ -2077,7 +2078,7 @@ imgExpand = all: -> imgExpand.on = @checked if imgExpand.on #expand - for thumb in $$ 'img[md5]:not([hidden])' + for thumb in $$ '.op > a > img[md5]:last-child, table:not([hidden]) img[md5]:last-child' imgExpand.expand thumb else #contract for thumb in $$ 'img[md5][hidden]'