Forgot to account for hidden posts.

This commit is contained in:
Zixaphir 2013-08-06 13:55:44 -07:00
parent 1227cbd847
commit 5507168019
3 changed files with 23 additions and 9 deletions

View File

@ -6283,7 +6283,7 @@
}
},
toggle: function(post) {
var headRect, rect, root, thumb, x, y;
var headRect, next, rect, root, thumb, x, y;
thumb = post.file.thumb;
if (!(post.file.isExpanded || $.hasClass(thumb, 'expanding'))) {
@ -6292,7 +6292,14 @@
}
ImageExpand.contract(post);
root = post.nodes.root;
rect = (Conf['Advance on contract'] ? $.x("following::div[contains(@class,'postContainer')][1]", root) || root : root).getBoundingClientRect();
if (Conf['Advance on contract']) {
while (next = $.x("following::div[contains(@class,'postContainer')][1]", root)) {
if (!($('.stub', next) || next.offsetHeight === 0)) {
break;
}
}
}
rect = (next || root).getBoundingClientRect();
if (rect.top < 0) {
y = rect.top;
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {

View File

@ -6263,7 +6263,7 @@
}
},
toggle: function(post) {
var headRect, rect, root, thumb, x, y;
var headRect, next, rect, root, thumb, x, y;
thumb = post.file.thumb;
if (!(post.file.isExpanded || $.hasClass(thumb, 'expanding'))) {
@ -6272,7 +6272,14 @@
}
ImageExpand.contract(post);
root = post.nodes.root;
rect = (Conf['Advance on contract'] ? $.x("following::div[contains(@class,'postContainer')][1]", root) || root : root).getBoundingClientRect();
if (Conf['Advance on contract']) {
while (next = $.x("following::div[contains(@class,'postContainer')][1]", root)) {
if (!($('.stub', next) || next.offsetHeight === 0)) {
break;
}
}
}
rect = (next || root).getBoundingClientRect();
if (rect.top < 0) {
y = rect.top;
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {

View File

@ -62,11 +62,11 @@ ImageExpand =
# Scroll back to the thumbnail when contracting the image
# to avoid being left miles away from the relevant post.
{root} = post.nodes
rect = (if Conf['Advance on contract']
$.x("following::div[contains(@class,'postContainer')][1]", root) or root
else
root
).getBoundingClientRect()
if Conf['Advance on contract']
while next = $.x "following::div[contains(@class,'postContainer')][1]", root
break unless $('.stub', next) or next.offsetHeight is 0
rect = (next or root).getBoundingClientRect()
if rect.top < 0
y = rect.top