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);
},
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;
@ -5127,20 +5127,24 @@
thumb.nextSibling.hidden = true;
return $.rmClass(thumb.parentNode.parentNode.parentNode, 'image_expanded');
},
expand: function(thumb, url) {
expand: function(thumb, src) {
var a, img;
if ($.x('ancestor-or-self::*[@hidden]', thumb)) {
return;
}
a = thumb.parentNode;
src || (src = a.href);
if (/\.pdf$/.test(src)) {
return;
}
thumb.hidden = true;
$.addClass(thumb.parentNode.parentNode.parentNode, 'image_expanded');
if (img = thumb.nextSibling) {
img.hidden = false;
return;
}
a = thumb.parentNode;
img = $.el('img', {
src: url || a.href
src: src
});
$.on(img, 'error', ImageExpand.error);
return $.add(a, img);
@ -5544,7 +5548,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 +5567,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;

View File

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

View File

@ -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
@ -4144,18 +4144,19 @@ ImageExpand =
thumb.nextSibling.hidden = true
$.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.
return if $.x 'ancestor-or-self::*[@hidden]', thumb
a = thumb.parentNode
src or= a.href
return if /\.pdf$/.test src
thumb.hidden = true
$.addClass thumb.parentNode.parentNode.parentNode, 'image_expanded'
if img = thumb.nextSibling
# Expand already loaded picture
img.hidden = false
return
a = thumb.parentNode
img = $.el 'img',
src: url or a.href
img = $.el 'img', { src }
$.on img, 'error', ImageExpand.error
$.add a, img
@ -4506,8 +4507,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) ->