post.hasPdf

This commit is contained in:
James Campos 2013-01-15 23:27:21 -08:00
parent e5355e450b
commit cc04f1b9e9
2 changed files with 13 additions and 9 deletions

View File

@ -4630,7 +4630,7 @@
return; return;
} }
$.id('postcount').textContent = ++ThreadStats.posts; $.id('postcount').textContent = ++ThreadStats.posts;
if (!post.img) { if (!post.img || post.hasPdf) {
return; return;
} }
imgcount = $.id('imagecount'); imgcount = $.id('imagecount');
@ -4920,7 +4920,7 @@
return Main.callbacks.push(this.node); return Main.callbacks.push(this.node);
}, },
node: function(post) { node: function(post) {
if (!post.img) { if (!post.img || post.hasPdf) {
return; return;
} }
return $.on(post.img, 'mouseover', ImageHover.mouseover); return $.on(post.img, 'mouseover', ImageHover.mouseover);
@ -5025,7 +5025,7 @@
}, },
node: function(post) { node: function(post) {
var a; var a;
if (!post.img) { if (!post.img || post.hasPdf) {
return; return;
} }
a = post.img.parentNode; a = post.img.parentNode;
@ -5544,7 +5544,7 @@
} }
}, },
preParse: function(node) { preParse: function(node) {
var el, img, parentClass, post; var el, img, imgParent, parentClass, post;
parentClass = node.parentNode.className; parentClass = node.parentNode.className;
el = $('.post', node); el = $('.post', node);
post = { post = {
@ -5563,8 +5563,10 @@
img: false img: false
}; };
if (img = $('img[data-md5]', el)) { if (img = $('img[data-md5]', el)) {
post.fileInfo = img.parentNode.previousElementSibling; imgParent = img.parentNode;
post.img = img; post.img = img;
post.fileInfo = imgParent.previousElementSibling;
post.hasPdf = /\.pdf$/.test(imgParent.href);
} }
Main.prettify(post.blockquote); Main.prettify(post.blockquote);
return post; return post;

View File

@ -3796,7 +3796,7 @@ ThreadStats =
node: (post) -> node: (post) ->
return if post.isInlined return if post.isInlined
$.id('postcount').textContent = ++ThreadStats.posts $.id('postcount').textContent = ++ThreadStats.posts
return unless post.img return if (!post.img or post.hasPdf)
imgcount = $.id 'imagecount' imgcount = $.id 'imagecount'
imgcount.textContent = ++ThreadStats.images imgcount.textContent = ++ThreadStats.images
if ThreadStats.images > ThreadStats.imgLimit if ThreadStats.images > ThreadStats.imgLimit
@ -4012,7 +4012,7 @@ ImageHover =
init: -> init: ->
Main.callbacks.push @node Main.callbacks.push @node
node: (post) -> node: (post) ->
return unless post.img return if (!post.img or post.hasPdf)
$.on post.img, 'mouseover', ImageHover.mouseover $.on post.img, 'mouseover', ImageHover.mouseover
mouseover: -> mouseover: ->
# Make sure to remove the previous image hover # Make sure to remove the previous image hover
@ -4078,7 +4078,7 @@ ImageExpand =
@dialog() @dialog()
node: (post) -> node: (post) ->
return unless post.img return if (!post.img or post.hasPdf)
a = post.img.parentNode a = post.img.parentNode
$.on a, 'click', ImageExpand.cb.toggle $.on a, 'click', ImageExpand.cb.toggle
if ImageExpand.on and !post.el.hidden if ImageExpand.on and !post.el.hidden
@ -4506,8 +4506,10 @@ Main =
if img = $ 'img[data-md5]', el if img = $ 'img[data-md5]', el
# Make sure to not add deleted images, # Make sure to not add deleted images,
# those do not have a data-md5 attribute. # those do not have a data-md5 attribute.
post.fileInfo = img.parentNode.previousElementSibling imgParent = img.parentNode
post.img = img post.img = img
post.fileInfo = imgParent.previousElementSibling
post.hasPdf = /\.pdf$/.test imgParent.href
Main.prettify post.blockquote Main.prettify post.blockquote
post post
node: (nodes, notify) -> node: (nodes, notify) ->