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) {
var bq, doc, post, quote, quotes, tmp, _i, _len;
var doc, node, post, quote, quotes, _i, _len;
if (req.status !== 200) {
a.textContent = "" + req.status + " " + req.statusText;
return;
@ -745,10 +745,8 @@
doc = d.implementation.createHTMLDocument(null);
doc.documentElement.innerHTML = req.responseText;
Threading.op($('body > form', doc).firstChild);
bq = doc.getElementById(replyID).lastChild;
tmp = $.el('div');
$.add(tmp, bq);
quotes = bq.getElementsByClassName('quotelink');
node = d.importNode(doc.getElementById(replyID));
quotes = node.getElementsByClassName('quotelink');
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
quote = quotes[_i];
if (quote.hash === quote.getAttribute('href')) {
@ -756,7 +754,7 @@
}
}
post = {
el: bq.parentNode,
el: node,
threadId: threadID,
quotes: quotes,
backlinks: []
@ -766,7 +764,7 @@
if (conf['Quote Inline']) QuoteInline.node(post);
if (conf['Indicate OP quote']) QuoteOP.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
Threading.op $('body > form', doc).firstChild
bq = doc.getElementById(replyID).lastChild
# Add the bq in a temporary element to fix quote.hashes
# Import the node to fix quote.hashes
# as they're empty when in a different document.
tmp = $.el 'div'
$.add tmp, bq
node = d.importNode doc.getElementById replyID
quotes = bq.getElementsByClassName 'quotelink'
quotes = node.getElementsByClassName 'quotelink'
for quote in quotes
if quote.hash is quote.getAttribute 'href'
quote.pathname = "/#{g.BOARD}/res/#{threadID}"
post =
el: bq.parentNode
el: node
threadId: threadID
quotes: quotes
backlinks: []
if conf['Resurrect Quotes']
Quotify.node post
Quotify.node post
if conf['Quote Preview']
QuotePreview.node post
if conf['Quote Inline']
@ -668,7 +665,7 @@ ExpandComment =
QuoteOP.node post
if conf['Indicate Cross-thread Quotes']
QuoteCT.node post
$.replace a.parentNode.parentNode, bq
$.replace a.parentNode.parentNode, node.lastChild
ExpandThread =
init: ->