Don't break linkifying when expanding comments.

This commit is contained in:
Nicolas Stepien 2012-09-10 17:46:07 +02:00
parent e603f40925
commit 040b314689
2 changed files with 13 additions and 9 deletions

View File

@ -874,7 +874,7 @@
}); });
}, },
parse: function(req, a, threadID, replyID) { parse: function(req, a, threadID, replyID) {
var bq, href, post, posts, quote, quotes, spoilerRange, _i, _j, _len, _len1; var bq, clone, href, post, posts, quote, quotes, spoilerRange, _i, _j, _len, _len1;
if (req.status !== 200) { if (req.status !== 200) {
a.textContent = "" + req.status + " " + req.statusText; a.textContent = "" + req.status + " " + req.statusText;
return; return;
@ -895,8 +895,9 @@
return; return;
} }
bq = $.id("m" + replyID); bq = $.id("m" + replyID);
bq.innerHTML = post.com; clone = bq.cloneNode(false);
quotes = bq.getElementsByClassName('quotelink'); clone.innerHTML = post.com;
quotes = clone.getElementsByClassName('quotelink');
for (_j = 0, _len1 = quotes.length; _j < _len1; _j++) { for (_j = 0, _len1 = quotes.length; _j < _len1; _j++) {
quote = quotes[_j]; quote = quotes[_j];
href = quote.getAttribute('href'); href = quote.getAttribute('href');
@ -906,7 +907,7 @@
quote.href = "res/" + href; quote.href = "res/" + href;
} }
post = { post = {
blockquote: bq, blockquote: clone,
threadID: threadID, threadID: threadID,
quotes: quotes, quotes: quotes,
backlinks: [] backlinks: []
@ -926,7 +927,8 @@
if (Conf['Indicate Cross-thread Quotes']) { if (Conf['Indicate Cross-thread Quotes']) {
QuoteCT.node(post); QuoteCT.node(post);
} }
return Main.prettify(bq); $.replace(bq, clone);
return Main.prettify(clone);
} }
}; };

View File

@ -729,14 +729,15 @@ ExpandComment =
return return
bq = $.id "m#{replyID}" bq = $.id "m#{replyID}"
bq.innerHTML = post.com clone = bq.cloneNode false
quotes = bq.getElementsByClassName 'quotelink' clone.innerHTML = post.com
quotes = clone.getElementsByClassName 'quotelink'
for quote in quotes for quote in quotes
href = quote.getAttribute 'href' href = quote.getAttribute 'href'
continue if href[0] is '/' # Cross-board quote continue if href[0] is '/' # Cross-board quote
quote.href = "res/#{href}" # Fix pathnames quote.href = "res/#{href}" # Fix pathnames
post = post =
blockquote: bq blockquote: clone
threadID: threadID threadID: threadID
quotes: quotes quotes: quotes
backlinks: [] backlinks: []
@ -750,7 +751,8 @@ 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
Main.prettify bq $.replace bq, clone
Main.prettify clone
ExpandThread = ExpandThread =
init: -> init: ->