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

View File

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