Last Comment Expansion x Quote Resurrection fix.

This commit is contained in:
Nicolas Stepien 2012-03-12 20:33:33 +01:00
parent 07afcd600c
commit 07e313b5cb
2 changed files with 11 additions and 16 deletions

View File

@ -737,7 +737,7 @@
})); }));
}, },
parse: function(req, a, threadID, replyID) { parse: function(req, a, threadID, replyID) {
var bq, doc, post, quote, quotes, tmp, _i, _len; var doc, node, post, quote, quotes, _i, _len;
if (req.status !== 200) { if (req.status !== 200) {
a.textContent = "" + req.status + " " + req.statusText; a.textContent = "" + req.status + " " + req.statusText;
return; return;
@ -745,10 +745,8 @@
doc = d.implementation.createHTMLDocument(null); doc = d.implementation.createHTMLDocument(null);
doc.documentElement.innerHTML = req.responseText; doc.documentElement.innerHTML = req.responseText;
Threading.op($('body > form', doc).firstChild); Threading.op($('body > form', doc).firstChild);
bq = doc.getElementById(replyID).lastChild; node = d.importNode(doc.getElementById(replyID));
tmp = $.el('div'); quotes = node.getElementsByClassName('quotelink');
$.add(tmp, bq);
quotes = bq.getElementsByClassName('quotelink');
for (_i = 0, _len = quotes.length; _i < _len; _i++) { for (_i = 0, _len = quotes.length; _i < _len; _i++) {
quote = quotes[_i]; quote = quotes[_i];
if (quote.hash === quote.getAttribute('href')) { if (quote.hash === quote.getAttribute('href')) {
@ -756,7 +754,7 @@
} }
} }
post = { post = {
el: bq.parentNode, el: node,
threadId: threadID, threadId: threadID,
quotes: quotes, quotes: quotes,
backlinks: [] backlinks: []
@ -766,7 +764,7 @@
if (conf['Quote Inline']) QuoteInline.node(post); if (conf['Quote Inline']) QuoteInline.node(post);
if (conf['Indicate OP quote']) QuoteOP.node(post); if (conf['Indicate OP quote']) QuoteOP.node(post);
if (conf['Indicate Cross-thread Quotes']) QuoteCT.node(post); if (conf['Indicate Cross-thread Quotes']) QuoteCT.node(post);
return $.replace(a.parentNode.parentNode, bq); return $.replace(a.parentNode.parentNode, node.lastChild);
} }
}; };

View File

@ -642,24 +642,21 @@ ExpandComment =
doc.documentElement.innerHTML = req.responseText doc.documentElement.innerHTML = req.responseText
Threading.op $('body > form', doc).firstChild Threading.op $('body > form', doc).firstChild
bq = doc.getElementById(replyID).lastChild # Import the node to fix quote.hashes
# Add the bq in a temporary element to fix quote.hashes
# as they're empty when in a different document. # as they're empty when in a different document.
tmp = $.el 'div' node = d.importNode doc.getElementById replyID
$.add tmp, bq
quotes = bq.getElementsByClassName 'quotelink' quotes = node.getElementsByClassName 'quotelink'
for quote in quotes for quote in quotes
if quote.hash is quote.getAttribute 'href' if quote.hash is quote.getAttribute 'href'
quote.pathname = "/#{g.BOARD}/res/#{threadID}" quote.pathname = "/#{g.BOARD}/res/#{threadID}"
post = post =
el: bq.parentNode el: node
threadId: threadID threadId: threadID
quotes: quotes quotes: quotes
backlinks: [] backlinks: []
if conf['Resurrect Quotes'] if conf['Resurrect Quotes']
Quotify.node post Quotify.node post
if conf['Quote Preview'] if conf['Quote Preview']
QuotePreview.node post QuotePreview.node post
if conf['Quote Inline'] if conf['Quote Inline']
@ -668,7 +665,7 @@ ExpandComment =
QuoteOP.node post QuoteOP.node post
if conf['Indicate Cross-thread Quotes'] if conf['Indicate Cross-thread Quotes']
QuoteCT.node post QuoteCT.node post
$.replace a.parentNode.parentNode, bq $.replace a.parentNode.parentNode, node.lastChild
ExpandThread = ExpandThread =
init: -> init: ->