ImageExpand.expand: return if pdf

This commit is contained in:
James Campos 2013-01-15 23:28:56 -08:00
parent cc04f1b9e9
commit 92adcaf28a
2 changed files with 12 additions and 7 deletions

View File

@ -5127,20 +5127,24 @@
thumb.nextSibling.hidden = true; thumb.nextSibling.hidden = true;
return $.rmClass(thumb.parentNode.parentNode.parentNode, 'image_expanded'); return $.rmClass(thumb.parentNode.parentNode.parentNode, 'image_expanded');
}, },
expand: function(thumb, url) { expand: function(thumb, src) {
var a, img; var a, img;
if ($.x('ancestor-or-self::*[@hidden]', thumb)) { if ($.x('ancestor-or-self::*[@hidden]', thumb)) {
return; return;
} }
a = thumb.parentNode;
src || (src = a.href);
if (/\.pdf$/.test(src)) {
return;
}
thumb.hidden = true; thumb.hidden = true;
$.addClass(thumb.parentNode.parentNode.parentNode, 'image_expanded'); $.addClass(thumb.parentNode.parentNode.parentNode, 'image_expanded');
if (img = thumb.nextSibling) { if (img = thumb.nextSibling) {
img.hidden = false; img.hidden = false;
return; return;
} }
a = thumb.parentNode;
img = $.el('img', { img = $.el('img', {
src: url || a.href src: src
}); });
$.on(img, 'error', ImageExpand.error); $.on(img, 'error', ImageExpand.error);
return $.add(a, img); return $.add(a, img);

View File

@ -4144,18 +4144,19 @@ ImageExpand =
thumb.nextSibling.hidden = true thumb.nextSibling.hidden = true
$.rmClass thumb.parentNode.parentNode.parentNode, 'image_expanded' $.rmClass thumb.parentNode.parentNode.parentNode, 'image_expanded'
expand: (thumb, url) -> expand: (thumb, src) ->
# Do not expand images of hidden/filtered replies, or already expanded pictures. # Do not expand images of hidden/filtered replies, or already expanded pictures.
return if $.x 'ancestor-or-self::*[@hidden]', thumb return if $.x 'ancestor-or-self::*[@hidden]', thumb
a = thumb.parentNode
src or= a.href
return if /\.pdf$/.test src
thumb.hidden = true thumb.hidden = true
$.addClass thumb.parentNode.parentNode.parentNode, 'image_expanded' $.addClass thumb.parentNode.parentNode.parentNode, 'image_expanded'
if img = thumb.nextSibling if img = thumb.nextSibling
# Expand already loaded picture # Expand already loaded picture
img.hidden = false img.hidden = false
return return
a = thumb.parentNode img = $.el 'img', { src }
img = $.el 'img',
src: url or a.href
$.on img, 'error', ImageExpand.error $.on img, 'error', ImageExpand.error
$.add a, img $.add a, img