Node preparsing related fixes in comment expanding.

This commit is contained in:
Nicolas Stepien 2012-03-03 20:08:12 +01:00
parent f310b8e47a
commit e394344f3e
2 changed files with 25 additions and 15 deletions

View File

@ -735,7 +735,7 @@
})); }));
}, },
parse: function(req, a, threadID, replyID) { parse: function(req, a, threadID, replyID) {
var body, bq, quote, reply, _i, _j, _len, _len2, _ref, _ref2; var body, bq, post, quote, quotes, reply, _i, _j, _len, _len2, _ref;
if (req.status !== 200) { if (req.status !== 200) {
a.textContent = "" + req.status + " " + req.statusText; a.textContent = "" + req.status + " " + req.statusText;
return; return;
@ -755,18 +755,23 @@
} }
} }
} }
_ref2 = $$('.quotelink', bq); quotes = $$('.quotelink', bq);
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { for (_j = 0, _len2 = quotes.length; _j < _len2; _j++) {
quote = _ref2[_j]; quote = quotes[_j];
if (quote.getAttribute('href') === quote.hash) { if (quote.getAttribute('href') === quote.hash) {
quote.pathname = "/" + g.BOARD + "/res/" + threadID; quote.pathname = "/" + g.BOARD + "/res/" + threadID;
} }
} }
$.replace(a.parentNode.parentNode, bq); $.replace($.x('ancestor::blockquote', a), bq);
if (conf['Quote Preview']) quotePreview.node(bq); post = {
if (conf['Quote Inline']) quoteInline.node(bq); threadId: threadID,
if (conf['Indicate OP quote']) quoteOP.node(bq); quotes: quotes,
if (conf['Indicate Cross-thread Quotes']) return quoteCT.node(bq); backlinks: []
};
if (conf['Quote Preview']) quotePreview.node(post);
if (conf['Quote Inline']) quoteInline.node(post);
if (conf['Indicate OP quote']) quoteOP.node(post);
if (conf['Indicate Cross-thread Quotes']) return quoteCT.node(post);
} }
}; };

View File

@ -641,18 +641,23 @@ expandComment =
if reply.id == replyID if reply.id == replyID
bq = $ 'blockquote', reply bq = $ 'blockquote', reply
break break
for quote in $$ '.quotelink', bq quotes = $$ '.quotelink', bq
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 $.replace $.x('ancestor::blockquote', a), bq
post =
threadId: threadID
quotes: quotes
backlinks: []
if conf['Quote Preview'] if conf['Quote Preview']
quotePreview.node bq quotePreview.node post
if conf['Quote Inline'] if conf['Quote Inline']
quoteInline.node bq quoteInline.node post
if conf['Indicate OP quote'] if conf['Indicate OP quote']
quoteOP.node bq quoteOP.node post
if conf['Indicate Cross-thread Quotes'] if conf['Indicate Cross-thread Quotes']
quoteCT.node bq quoteCT.node post
expandThread = expandThread =
init: -> init: ->