fix slow scrolling

This commit is contained in:
James Campos 2010-12-29 14:05:49 -08:00
parent c03072f0e0
commit 38408ecde0
2 changed files with 11 additions and 5 deletions

View File

@ -1141,11 +1141,12 @@ recaptcha.addEventListener('keydown', recaptchaListener, true)
scroll = ->
height = document.body.clientHeight
while reply = g.replies[0]
for reply, i in g.replies
bottom = reply.getBoundingClientRect().bottom
if bottom > height #post is not completely read
break
g.replies.shift()
if i is 0 then return
g.replies = g.replies[i..]
updateTitle()
#major features

View File

@ -1429,15 +1429,20 @@
recaptcha = $('#recaptcha_response_field');
recaptcha.addEventListener('keydown', recaptchaListener, true);
scroll = function() {
var bottom, height, reply;
var bottom, height, i, reply, _len, _ref;
height = document.body.clientHeight;
while (reply = g.replies[0]) {
_ref = g.replies;
for (i = 0, _len = _ref.length; i < _len; i++) {
reply = _ref[i];
bottom = reply.getBoundingClientRect().bottom;
if (bottom > height) {
break;
}
g.replies.shift();
}
if (i === 0) {
return;
}
g.replies = g.replies.slice(i);
return updateTitle();
};
if (getConfig('Restore IDs')) {