Scroll the reply to the bottom of the window; scroll only if the last reply is mostly visible, not when we're at the bottom; fix previousElementSibling, apparently it doesn't work on every boards.
This commit is contained in:
parent
0383a3629a
commit
f9c36d4704
@ -1994,12 +1994,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
replies = $$('.reply', body);
|
replies = $$('.reply', body);
|
||||||
id = Number(((_ref2 = $('td[id]', updater.br.previousSibling)) != null ? _ref2.id : void 0) || 0);
|
id = Number(((_ref2 = $('td[id]', updater.br.previousElementSibling)) != null ? _ref2.id : void 0) || 0);
|
||||||
arr = [];
|
arr = [];
|
||||||
while ((reply = replies.pop()) && (reply.id > id)) {
|
while ((reply = replies.pop()) && (reply.id > id)) {
|
||||||
arr.push(reply.parentNode.parentNode.parentNode);
|
arr.push(reply.parentNode.parentNode.parentNode);
|
||||||
}
|
}
|
||||||
scroll = conf['Scrolling'] && updater.scrollBG() && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20);
|
scroll = conf['Scrolling'] && updater.scrollBG() && arr.length && updater.br.previousElementSibling.getBoundingClientRect().bottom - d.body.clientHeight < 25;
|
||||||
if (conf['Verbose']) {
|
if (conf['Verbose']) {
|
||||||
updater.count.textContent = '+' + arr.length;
|
updater.count.textContent = '+' + arr.length;
|
||||||
if (arr.length === 0) {
|
if (arr.length === 0) {
|
||||||
@ -2012,7 +2012,7 @@
|
|||||||
$.before(updater.br, reply);
|
$.before(updater.br, reply);
|
||||||
}
|
}
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
return updater.br.previousSibling.scrollIntoView();
|
return updater.br.previousSibling.scrollIntoView(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1516,12 +1516,13 @@ updater =
|
|||||||
return
|
return
|
||||||
|
|
||||||
replies = $$ '.reply', body
|
replies = $$ '.reply', body
|
||||||
id = Number $('td[id]', updater.br.previousSibling)?.id or 0
|
id = Number $('td[id]', updater.br.previousElementSibling)?.id or 0
|
||||||
arr = []
|
arr = []
|
||||||
while (reply = replies.pop()) and (reply.id > id)
|
while (reply = replies.pop()) and (reply.id > id)
|
||||||
arr.push reply.parentNode.parentNode.parentNode #table
|
arr.push reply.parentNode.parentNode.parentNode #table
|
||||||
|
|
||||||
scroll = conf['Scrolling'] && updater.scrollBG() && arr.length && (d.body.scrollHeight - d.body.clientHeight - window.scrollY < 20)
|
scroll = conf['Scrolling'] && updater.scrollBG() && arr.length &&
|
||||||
|
updater.br.previousElementSibling.getBoundingClientRect().bottom - d.body.clientHeight < 25
|
||||||
if conf['Verbose']
|
if conf['Verbose']
|
||||||
updater.count.textContent = '+' + arr.length
|
updater.count.textContent = '+' + arr.length
|
||||||
if arr.length is 0
|
if arr.length is 0
|
||||||
@ -1533,7 +1534,7 @@ updater =
|
|||||||
while reply = arr.pop()
|
while reply = arr.pop()
|
||||||
$.before updater.br, reply
|
$.before updater.br, reply
|
||||||
if scroll
|
if scroll
|
||||||
updater.br.previousSibling.scrollIntoView()
|
updater.br.previousSibling.scrollIntoView(false)
|
||||||
|
|
||||||
timeout: ->
|
timeout: ->
|
||||||
updater.timeoutID = setTimeout updater.timeout, 1000
|
updater.timeoutID = setTimeout updater.timeout, 1000
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user