Do not waste bandwidth loading pictures of filtered posts.

This commit is contained in:
Nicolas Stepien 2011-11-25 22:16:18 +01:00
parent 063d88d4a4
commit c0294019b7
2 changed files with 7 additions and 6 deletions

View File

@ -2700,7 +2700,7 @@
init: function() { init: function() {
return g.callbacks.push(function(root) { return g.callbacks.push(function(root) {
var src, thumb; var src, thumb;
if (!(thumb = $('img[md5]', root))) return; if (root.hidden || !(thumb = $('img[md5]', root))) return;
src = thumb.parentNode.href; src = thumb.parentNode.href;
if (/gif$/.test(src)) return thumb.src = src; if (/gif$/.test(src)) return thumb.src = src;
}); });
@ -2717,7 +2717,7 @@
if (!(thumb = $('img[md5]', root))) return; if (!(thumb = $('img[md5]', root))) return;
a = thumb.parentNode; a = thumb.parentNode;
$.on(a, 'click', imgExpand.cb.toggle); $.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); return imgExpand.expand(a.firstChild);
} }
}, },
@ -2731,7 +2731,7 @@
var thumb, _i, _j, _len, _len2, _ref, _ref2, _results, _results2; var thumb, _i, _j, _len, _len2, _ref, _ref2, _results, _results2;
imgExpand.on = this.checked; imgExpand.on = this.checked;
if (imgExpand.on) { if (imgExpand.on) {
_ref = $$('img[md5]:not([hidden])'); _ref = $$('.op > a > img[md5]:last-child, table:not([hidden]) img[md5]:last-child');
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
thumb = _ref[_i]; thumb = _ref[_i];

View File

@ -2054,7 +2054,7 @@ imgHover =
imgGif = imgGif =
init: -> init: ->
g.callbacks.push (root) -> g.callbacks.push (root) ->
return unless thumb = $ 'img[md5]', root return if root.hidden or !thumb = $ 'img[md5]', root
src = thumb.parentNode.href src = thumb.parentNode.href
if /gif$/.test src if /gif$/.test src
thumb.src = src thumb.src = src
@ -2068,7 +2068,8 @@ imgExpand =
return unless thumb = $ 'img[md5]', root return unless thumb = $ 'img[md5]', root
a = thumb.parentNode a = thumb.parentNode
$.on a, 'click', imgExpand.cb.toggle $.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: cb:
toggle: (e) -> toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0 return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
@ -2077,7 +2078,7 @@ imgExpand =
all: -> all: ->
imgExpand.on = @checked imgExpand.on = @checked
if imgExpand.on #expand 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 imgExpand.expand thumb
else #contract else #contract
for thumb in $$ 'img[md5][hidden]' for thumb in $$ 'img[md5][hidden]'