Fix "Advance on contract" option with Quote Threading
This commit is contained in:
parent
d02ce2ff0f
commit
7939d24640
@ -6283,7 +6283,7 @@
|
||||
}
|
||||
},
|
||||
toggle: function(post) {
|
||||
var headRect, node, rect, thumb, x, y;
|
||||
var headRect, rect, root, thumb, x, y;
|
||||
|
||||
thumb = post.file.thumb;
|
||||
if (!(post.file.isExpanded || $.hasClass(thumb, 'expanding'))) {
|
||||
@ -6291,28 +6291,17 @@
|
||||
return;
|
||||
}
|
||||
ImageExpand.contract(post);
|
||||
node = post.nodes.root;
|
||||
rect = Conf['Advance on contract'] ? (function() {
|
||||
while (node.nextElementSibling) {
|
||||
if (!(node = node.nextElementSibling)) {
|
||||
return post.nodes.root;
|
||||
}
|
||||
if (!$.hasClass(node, 'postContainer')) {
|
||||
continue;
|
||||
}
|
||||
if (node.offsetHeight > 0 && !$('.stub', node)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return node.getBoundingClientRect();
|
||||
})() : post.nodes.root.getBoundingClientRect();
|
||||
if (!(rect.top <= 0 || rect.left <= 0)) {
|
||||
return;
|
||||
}
|
||||
root = post.nodes.root;
|
||||
rect = (Conf['Advance on contract'] ? (function() {
|
||||
var next;
|
||||
|
||||
next = $.x("following::div[contains(@class,'postContainer')][1]", root);
|
||||
return next || root;
|
||||
})() : root).getBoundingClientRect();
|
||||
if (rect.top < 0) {
|
||||
y = rect.top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.toggle.getBoundingClientRect();
|
||||
headRect = Header.bar.getBoundingClientRect();
|
||||
y -= headRect.top + headRect.height;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6263,7 +6263,7 @@
|
||||
}
|
||||
},
|
||||
toggle: function(post) {
|
||||
var headRect, node, rect, thumb, x, y;
|
||||
var headRect, rect, root, thumb, x, y;
|
||||
|
||||
thumb = post.file.thumb;
|
||||
if (!(post.file.isExpanded || $.hasClass(thumb, 'expanding'))) {
|
||||
@ -6271,28 +6271,17 @@
|
||||
return;
|
||||
}
|
||||
ImageExpand.contract(post);
|
||||
node = post.nodes.root;
|
||||
rect = Conf['Advance on contract'] ? (function() {
|
||||
while (node.nextElementSibling) {
|
||||
if (!(node = node.nextElementSibling)) {
|
||||
return post.nodes.root;
|
||||
}
|
||||
if (!$.hasClass(node, 'postContainer')) {
|
||||
continue;
|
||||
}
|
||||
if (node.offsetHeight > 0 && !$('.stub', node)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return node.getBoundingClientRect();
|
||||
})() : post.nodes.root.getBoundingClientRect();
|
||||
if (!(rect.top <= 0 || rect.left <= 0)) {
|
||||
return;
|
||||
}
|
||||
root = post.nodes.root;
|
||||
rect = (Conf['Advance on contract'] ? (function() {
|
||||
var next;
|
||||
|
||||
next = $.x("following::div[contains(@class,'postContainer')][1]", root);
|
||||
return next || root;
|
||||
})() : root).getBoundingClientRect();
|
||||
if (rect.top < 0) {
|
||||
y = rect.top;
|
||||
if (Conf['Fixed Header'] && !Conf['Bottom Header']) {
|
||||
headRect = Header.toggle.getBoundingClientRect();
|
||||
headRect = Header.bar.getBoundingClientRect();
|
||||
y -= headRect.top + headRect.height;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,24 +59,19 @@ ImageExpand =
|
||||
ImageExpand.expand post
|
||||
return
|
||||
ImageExpand.contract post
|
||||
node = post.nodes.root
|
||||
# Scroll back to the thumbnail when contracting the image
|
||||
# to avoid being left miles away from the relevant post.
|
||||
rect = if Conf['Advance on contract'] then do ->
|
||||
# FIXME does not work with Quote Threading
|
||||
while node.nextElementSibling
|
||||
return post.nodes.root unless node = node.nextElementSibling
|
||||
continue unless $.hasClass node, 'postContainer'
|
||||
break if node.offsetHeight > 0 and not $ '.stub', node
|
||||
node.getBoundingClientRect()
|
||||
{root} = post.nodes
|
||||
rect = (if Conf['Advance on contract'] then do ->
|
||||
next = $.x "following::div[contains(@class,'postContainer')][1]", root
|
||||
next or root
|
||||
else
|
||||
post.nodes.root.getBoundingClientRect()
|
||||
return unless rect.top <= 0 or rect.left <= 0
|
||||
root).getBoundingClientRect()
|
||||
|
||||
if rect.top < 0
|
||||
y = rect.top
|
||||
if Conf['Fixed Header'] and not Conf['Bottom Header']
|
||||
headRect = Header.toggle.getBoundingClientRect()
|
||||
headRect = Header.bar.getBoundingClientRect()
|
||||
y -= headRect.top + headRect.height
|
||||
|
||||
if rect.left < 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user