Merge branch 'master' of github.com:MayhemYDG/4chan-x

This commit is contained in:
Nicolas Stepien 2013-01-18 22:06:42 +01:00
commit e2718c18b6
3 changed files with 25 additions and 14 deletions

View File

@ -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;
@ -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);
@ -5544,7 +5548,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 +5567,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

@ -1,4 +1,6 @@
master master
- James Campos
Don't expand pdfs
- Mayhem - Mayhem
Add /po/ archive redirection for threads, images and post resurrection. Add /po/ archive redirection for threads, images and post resurrection.
Fix quoting. Fix quoting.

View File

@ -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
@ -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
@ -4506,8 +4507,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) ->