post.img -> img in auto-gif.

This commit is contained in:
Nicolas Stepien 2012-05-02 11:24:03 +02:00
parent e6954fd254
commit c6a72d9fae
2 changed files with 17 additions and 15 deletions

View File

@ -3710,17 +3710,18 @@
return Main.callbacks.push(this.node); return Main.callbacks.push(this.node);
}, },
node: function(post) { node: function(post) {
var img, src; var gif, img, src;
if (post.root.hidden || !post.img) { img = post.img;
if (post.root.hidden || !img) {
return; return;
} }
src = post.img.parentNode.href; src = img.parentNode.href;
if (/gif$/.test(src) && !/spoiler/.test(post.img.src)) { if (/gif$/.test(src) && !/spoiler/.test(img.src)) {
img = $.el('img'); gif = $.el('img');
$.on(img, 'load', function() { $.on(gif, 'load', function() {
return post.img.src = src; return img.src = src;
}); });
return img.src = src; return gif.src = src;
} }
} }
}; };

View File

@ -2845,14 +2845,15 @@ AutoGif =
return if g.BOARD is 'gif' return if g.BOARD is 'gif'
Main.callbacks.push @node Main.callbacks.push @node
node: (post) -> node: (post) ->
return if post.root.hidden or not post.img {img} = post
src = post.img.parentNode.href return if post.root.hidden or not img
if /gif$/.test(src) and !/spoiler/.test post.img.src src = img.parentNode.href
img = $.el 'img' if /gif$/.test(src) and !/spoiler/.test img.src
$.on img, 'load', -> gif = $.el 'img'
$.on gif, 'load', ->
# Replace the thumbnail once the GIF has finished loading. # Replace the thumbnail once the GIF has finished loading.
post.img.src = src img.src = src
img.src = src gif.src = src
ImageExpand = ImageExpand =
init: -> init: ->