I think I'm satisfied with this now.

This commit is contained in:
Zixaphir 2013-08-06 14:16:49 -07:00
parent 5507168019
commit 9159f7adbc
3 changed files with 31 additions and 19 deletions

View File

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

View File

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