Links in a locationless document have their hash, and probably more, values empty. Also shave some lines.

This commit is contained in:
Nicolas Stepien 2012-03-11 05:13:04 +01:00
parent 8ed8309b31
commit 8514eae046
2 changed files with 13 additions and 21 deletions

View File

@ -744,6 +744,7 @@
doc = d.implementation.createHTMLDocument();
doc.documentElement.innerHTML = req.responseText;
bq = threadID === replyID ? $('blockquote', doc) : $('blockquote', doc.getElementById(replyID));
$.replace(a.parentNode.parentNode, bq);
quotes = $$('.quotelink', bq);
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
quote = quotes[_i];
@ -751,7 +752,6 @@
quote.pathname = "/" + g.BOARD + "/res/" + threadID;
}
}
$.replace(a.parentNode.parentNode, bq);
post = {
threadId: threadID,
quotes: quotes,
@ -2559,7 +2559,7 @@
};
},
update: function() {
var body, id, newPosts, nodes, reply, scroll, _i, _len, _ref, _ref2;
var body, id, newPosts, nodes, reply, scroll, _i, _len, _ref;
if (this.status === 404) {
Updater.timer.textContent = '';
Updater.count.textContent = 404;
@ -2598,23 +2598,19 @@
body = $.el('body', {
innerHTML: this.responseText
});
id = ((_ref = $('td[id]', Updater.br.previousElementSibling)) != null ? _ref.id : void 0) || 0;
id = $('input', Updater.br.previousElementSibling).name;
nodes = [];
_ref2 = $$('.reply', body).reverse();
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
reply = _ref2[_i];
_ref = $$('.reply', body).reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
reply = _ref[_i];
if (reply.id <= id) break;
nodes.push(reply.parentNode.parentNode.parentNode);
}
newPosts = nodes.length;
scroll = conf['Scrolling'] && Updater.scrollBG() && newPosts && Updater.br.previousElementSibling.getBoundingClientRect().bottom - d.body.clientHeight < 25;
if (conf['Verbose']) {
Updater.count.textContent = '+' + newPosts;
if (newPosts === 0) {
Updater.count.className = null;
} else {
Updater.count.className = 'new';
}
Updater.count.textContent = "+" + newPosts;
Updater.count.className = newPosts ? 'new' : null;
}
$.before(Updater.br, nodes.reverse());
if (scroll) return Updater.br.previousSibling.scrollIntoView();

View File

@ -645,11 +645,11 @@ ExpandComment =
$ 'blockquote', doc
else
$ 'blockquote', doc.getElementById replyID
$.replace a.parentNode.parentNode, bq
quotes = $$ '.quotelink', bq
for quote in quotes
if quote.getAttribute('href') is quote.hash
quote.pathname = "/#{g.BOARD}/res/#{threadID}"
$.replace a.parentNode.parentNode, bq
post =
threadId: threadID
quotes: quotes
@ -2198,22 +2198,18 @@ Updater =
body = $.el 'body',
innerHTML: @responseText
id = $('td[id]', Updater.br.previousElementSibling)?.id or 0
id = $('input', Updater.br.previousElementSibling).name
nodes = []
for reply in $$('.reply', body).reverse()
if reply.id <= id #make sure to not insert older posts
break
break if reply.id <= id #make sure to not insert older posts
nodes.push reply.parentNode.parentNode.parentNode #table
newPosts = nodes.length
scroll = conf['Scrolling'] && Updater.scrollBG() && newPosts &&
Updater.br.previousElementSibling.getBoundingClientRect().bottom - d.body.clientHeight < 25
if conf['Verbose']
Updater.count.textContent = '+' + newPosts
if newPosts is 0
Updater.count.className = null
else
Updater.count.className = 'new'
Updater.count.textContent = "+#{newPosts}"
Updater.count.className = if newPosts then 'new' else null
$.before Updater.br, nodes.reverse()
if scroll