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

View File

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

View File

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