Small improvements in the updater.cb.update

This commit is contained in:
Nicolas Stepien 2011-08-26 23:35:02 +02:00
parent 37c20165d6
commit 1c2eb0bf9b
2 changed files with 9 additions and 9 deletions

View File

@ -1693,6 +1693,7 @@
}, html);
updater.count = $('#count', dialog);
updater.timer = $('#timer', dialog);
updater.br = $('br[clear]');
_ref = $$('input', dialog);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
input = _ref[_i];
@ -1740,7 +1741,7 @@
}
},
update: function() {
var arr, body, br, id, input, replies, reply, scroll, _i, _len, _ref, _ref2;
var arr, body, id, input, replies, reply, scroll, _i, _len, _ref, _ref2;
if (this.status === 404) {
updater.timer.textContent = '';
updater.count.textContent = 404;
@ -1757,13 +1758,12 @@
Favicon.update();
return;
}
br = $('br[clear]');
id = Number(((_ref2 = $('td[id]', br.previousElementSibling)) != null ? _ref2.id : void 0) || 0);
id = Number(((_ref2 = $('td[id]', updater.br.previousElementSibling)) != null ? _ref2.id : void 0) || 0);
arr = [];
body = $.el('body', {
innerHTML: this.responseText
});
replies = $$('td[id]', body);
replies = $$('.reply', body);
while ((reply = replies.pop()) && (reply.id > id)) {
arr.push(reply.parentNode.parentNode.parentNode);
}
@ -1778,7 +1778,7 @@
}
}
while (reply = arr.pop()) {
$.before(br, reply);
$.before(updater.br, reply);
}
if (scroll) {
return scrollTo(0, d.body.scrollHeight);

View File

@ -1397,6 +1397,7 @@ updater =
updater.count = $ '#count', dialog
updater.timer = $ '#timer', dialog
updater.br = $ 'br[clear]'
for input in $$ 'input', dialog
if input.type is 'checkbox'
@ -1445,13 +1446,12 @@ updater =
Favicon.update()
return
br = $ 'br[clear]'
id = Number $('td[id]', br.previousElementSibling)?.id or 0
id = Number $('td[id]', updater.br.previousElementSibling)?.id or 0
arr = []
body = $.el 'body',
innerHTML: @responseText
replies = $$ 'td[id]', body
replies = $$ '.reply', body
while (reply = replies.pop()) and (reply.id > id)
arr.push reply.parentNode.parentNode.parentNode #table
@ -1467,7 +1467,7 @@ updater =
#XXX add replies in correct order so backlinks resolve
while reply = arr.pop()
$.before br, reply
$.before updater.br, reply
if scroll
scrollTo 0, d.body.scrollHeight