d.documentElement -> doc
This commit is contained in:
parent
d827a6c317
commit
aed462712e
@ -2762,7 +2762,7 @@
|
|||||||
if (postEl = $('.reply.highlight', thread)) {
|
if (postEl = $('.reply.highlight', thread)) {
|
||||||
$.rmClass(postEl, 'highlight');
|
$.rmClass(postEl, 'highlight');
|
||||||
rect = postEl.getBoundingClientRect();
|
rect = postEl.getBoundingClientRect();
|
||||||
if (rect.bottom >= topMargin && rect.top <= d.documentElement.clientHeight) {
|
if (rect.bottom >= topMargin && rect.top <= doc.clientHeight) {
|
||||||
root = postEl.parentNode;
|
root = postEl.parentNode;
|
||||||
next = $.x('child::div[contains(@class,"post reply")]', delta === +1 ? root.nextElementSibling : root.previousElementSibling);
|
next = $.x('child::div[contains(@class,"post reply")]', delta === +1 ? root.nextElementSibling : root.previousElementSibling);
|
||||||
if (!next) {
|
if (!next) {
|
||||||
@ -2773,7 +2773,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rect = next.getBoundingClientRect();
|
rect = next.getBoundingClientRect();
|
||||||
if (rect.top < 0 || rect.bottom > d.documentElement.clientHeight) {
|
if (rect.top < 0 || rect.bottom > doc.clientHeight) {
|
||||||
if (delta === -1) {
|
if (delta === -1) {
|
||||||
window.scrollBy(0, rect.top - topMargin);
|
window.scrollBy(0, rect.top - topMargin);
|
||||||
} else {
|
} else {
|
||||||
@ -2791,7 +2791,7 @@
|
|||||||
for (_i = 0, _len = replies.length; _i < _len; _i++) {
|
for (_i = 0, _len = replies.length; _i < _len; _i++) {
|
||||||
reply = replies[_i];
|
reply = replies[_i];
|
||||||
rect = reply.getBoundingClientRect();
|
rect = reply.getBoundingClientRect();
|
||||||
if (delta === +1 && rect.top >= topMargin || delta === -1 && rect.bottom <= d.documentElement.clientHeight) {
|
if (delta === +1 && rect.top >= topMargin || delta === -1 && rect.bottom <= doc.clientHeight) {
|
||||||
this.focus(reply);
|
this.focus(reply);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4265,7 +4265,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function(post) {
|
toggle: function(post) {
|
||||||
var headRect, postRect, rect, thumb, top;
|
var headRect, postRect, rect, root, thumb, top;
|
||||||
thumb = post.file.thumb;
|
thumb = post.file.thumb;
|
||||||
if (!thumb.hidden) {
|
if (!thumb.hidden) {
|
||||||
ImageExpand.expand(post);
|
ImageExpand.expand(post);
|
||||||
@ -4276,20 +4276,12 @@
|
|||||||
postRect = post.nodes.root.getBoundingClientRect();
|
postRect = post.nodes.root.getBoundingClientRect();
|
||||||
headRect = $.id('header-bar').getBoundingClientRect();
|
headRect = $.id('header-bar').getBoundingClientRect();
|
||||||
top = postRect.top - headRect.top - headRect.height - 2;
|
top = postRect.top - headRect.top - headRect.height - 2;
|
||||||
if ($.engine === 'webkit') {
|
root = $.engine === 'webkit' ? d.body : doc;
|
||||||
if (rect.top < 0) {
|
if (rect.top < 0) {
|
||||||
d.body.scrollTop += top;
|
root.scrollTop += top;
|
||||||
}
|
}
|
||||||
if (rect.left < 0) {
|
if (rect.left < 0) {
|
||||||
d.body.scrollLeft = 0;
|
root.scrollLeft = 0;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (rect.top < 0) {
|
|
||||||
d.documentElement.scrollTop += top;
|
|
||||||
}
|
|
||||||
if (rect.left < 0) {
|
|
||||||
d.documentElement.scrollLeft = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ImageExpand.contract(post);
|
return ImageExpand.contract(post);
|
||||||
|
|||||||
@ -1511,7 +1511,7 @@ Keybinds =
|
|||||||
if postEl = $ '.reply.highlight', thread
|
if postEl = $ '.reply.highlight', thread
|
||||||
$.rmClass postEl, 'highlight'
|
$.rmClass postEl, 'highlight'
|
||||||
rect = postEl.getBoundingClientRect()
|
rect = postEl.getBoundingClientRect()
|
||||||
if rect.bottom >= topMargin and rect.top <= d.documentElement.clientHeight # We're at least partially visible
|
if rect.bottom >= topMargin and rect.top <= doc.clientHeight # We're at least partially visible
|
||||||
root = postEl.parentNode
|
root = postEl.parentNode
|
||||||
next = $.x 'child::div[contains(@class,"post reply")]',
|
next = $.x 'child::div[contains(@class,"post reply")]',
|
||||||
if delta is +1 then root.nextElementSibling else root.previousElementSibling
|
if delta is +1 then root.nextElementSibling else root.previousElementSibling
|
||||||
@ -1520,7 +1520,7 @@ Keybinds =
|
|||||||
return
|
return
|
||||||
return unless g.VIEW is 'thread' or $.x('ancestor::div[parent::div[@class="board"]]', next) is thread
|
return unless g.VIEW is 'thread' or $.x('ancestor::div[parent::div[@class="board"]]', next) is thread
|
||||||
rect = next.getBoundingClientRect()
|
rect = next.getBoundingClientRect()
|
||||||
if rect.top < 0 or rect.bottom > d.documentElement.clientHeight
|
if rect.top < 0 or rect.bottom > doc.clientHeight
|
||||||
if delta is -1
|
if delta is -1
|
||||||
window.scrollBy 0, rect.top - topMargin
|
window.scrollBy 0, rect.top - topMargin
|
||||||
else
|
else
|
||||||
@ -1532,7 +1532,7 @@ Keybinds =
|
|||||||
replies.reverse() if delta is -1
|
replies.reverse() if delta is -1
|
||||||
for reply in replies
|
for reply in replies
|
||||||
rect = reply.getBoundingClientRect()
|
rect = reply.getBoundingClientRect()
|
||||||
if delta is +1 and rect.top >= topMargin or delta is -1 and rect.bottom <= d.documentElement.clientHeight
|
if delta is +1 and rect.top >= topMargin or delta is -1 and rect.bottom <= doc.clientHeight
|
||||||
@focus reply
|
@focus reply
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -2827,12 +2827,12 @@ ImageExpand =
|
|||||||
postRect = post.nodes.root.getBoundingClientRect()
|
postRect = post.nodes.root.getBoundingClientRect()
|
||||||
headRect = $.id('header-bar').getBoundingClientRect()
|
headRect = $.id('header-bar').getBoundingClientRect()
|
||||||
top = postRect.top - headRect.top - headRect.height - 2
|
top = postRect.top - headRect.top - headRect.height - 2
|
||||||
if $.engine is 'webkit'
|
root = if $.engine is 'webkit'
|
||||||
d.body.scrollTop += top if rect.top < 0
|
d.body
|
||||||
d.body.scrollLeft = 0 if rect.left < 0
|
|
||||||
else
|
else
|
||||||
d.documentElement.scrollTop += top if rect.top < 0
|
doc
|
||||||
d.documentElement.scrollLeft = 0 if rect.left < 0
|
root.scrollTop += top if rect.top < 0
|
||||||
|
root.scrollLeft = 0 if rect.left < 0
|
||||||
ImageExpand.contract post
|
ImageExpand.contract post
|
||||||
|
|
||||||
contract: (post) ->
|
contract: (post) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user