diff --git a/4chan_x.user.js b/4chan_x.user.js index 992e74ebc..fb5803d1d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4630,7 +4630,7 @@ return; } $.id('postcount').textContent = ++ThreadStats.posts; - if (!post.img) { + if (!post.img || post.hasPdf) { return; } imgcount = $.id('imagecount'); @@ -4920,7 +4920,7 @@ return Main.callbacks.push(this.node); }, node: function(post) { - if (!post.img) { + if (!post.img || post.hasPdf) { return; } return $.on(post.img, 'mouseover', ImageHover.mouseover); @@ -5025,7 +5025,7 @@ }, node: function(post) { var a; - if (!post.img) { + if (!post.img || post.hasPdf) { return; } a = post.img.parentNode; @@ -5544,7 +5544,7 @@ } }, preParse: function(node) { - var el, img, parentClass, post; + var el, img, imgParent, parentClass, post; parentClass = node.parentNode.className; el = $('.post', node); post = { @@ -5563,8 +5563,10 @@ img: false }; if (img = $('img[data-md5]', el)) { - post.fileInfo = img.parentNode.previousElementSibling; + imgParent = img.parentNode; post.img = img; + post.fileInfo = imgParent.previousElementSibling; + post.hasPdf = /\.pdf$/.test(imgParent.href); } Main.prettify(post.blockquote); return post; diff --git a/script.coffee b/script.coffee index a0a18901b..8f8021a83 100644 --- a/script.coffee +++ b/script.coffee @@ -3796,7 +3796,7 @@ ThreadStats = node: (post) -> return if post.isInlined $.id('postcount').textContent = ++ThreadStats.posts - return unless post.img + return if (!post.img or post.hasPdf) imgcount = $.id 'imagecount' imgcount.textContent = ++ThreadStats.images if ThreadStats.images > ThreadStats.imgLimit @@ -4012,7 +4012,7 @@ ImageHover = init: -> Main.callbacks.push @node node: (post) -> - return unless post.img + return if (!post.img or post.hasPdf) $.on post.img, 'mouseover', ImageHover.mouseover mouseover: -> # Make sure to remove the previous image hover @@ -4078,7 +4078,7 @@ ImageExpand = @dialog() node: (post) -> - return unless post.img + return if (!post.img or post.hasPdf) a = post.img.parentNode $.on a, 'click', ImageExpand.cb.toggle if ImageExpand.on and !post.el.hidden @@ -4506,8 +4506,10 @@ Main = if img = $ 'img[data-md5]', el # Make sure to not add deleted images, # those do not have a data-md5 attribute. - post.fileInfo = img.parentNode.previousElementSibling + imgParent = img.parentNode post.img = img + post.fileInfo = imgParent.previousElementSibling + post.hasPdf = /\.pdf$/.test imgParent.href Main.prettify post.blockquote post node: (nodes, notify) ->