diff --git a/4chan_x.user.js b/4chan_x.user.js index 8cf7c165d..33ad0a194 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2478,7 +2478,9 @@ init: function() { return g.callbacks.push(function(root) { var el, src, thumb; - thumb = $('img[md5]', root); + if (!(thumb = $('img[md5]', root))) { + return; + } src = thumb.parentNode.href; return el = $.el('img', { src: src @@ -2490,7 +2492,9 @@ init: function() { return g.callbacks.push(function(root) { var src, thumb; - thumb = $('img[md5]', root); + if (!(thumb = $('img[md5]', root))) { + return; + } src = thumb.parentNode.href; if (/gif$/.test(src)) { return thumb.src = src; diff --git a/script.coffee b/script.coffee index 29a08d550..15d603dfb 100644 --- a/script.coffee +++ b/script.coffee @@ -1874,14 +1874,14 @@ imageHover = imgPreloading = init: -> g.callbacks.push (root) -> - thumb = $ 'img[md5]', root + return unless thumb = $ 'img[md5]', root src = thumb.parentNode.href el = $.el 'img', { src } imgGif = init: -> g.callbacks.push (root) -> - thumb = $ 'img[md5]', root + return unless thumb = $ 'img[md5]', root src = thumb.parentNode.href if /gif$/.test src thumb.src = src