Fix compatibility between Linkify Plus and Comment Expansion x Quote Resurrection.
This commit is contained in:
parent
0fe4287356
commit
4d87791b79
@ -737,33 +737,36 @@
|
||||
}));
|
||||
},
|
||||
parse: function(req, a, threadID, replyID) {
|
||||
var bq, doc, post, quote, quotes, _i, _len;
|
||||
var bq, doc, post, quote, quotes, tmp, _i, _len;
|
||||
if (req.status !== 200) {
|
||||
a.textContent = "" + req.status + " " + req.statusText;
|
||||
return;
|
||||
}
|
||||
doc = d.implementation.createHTMLDocument(null);
|
||||
doc.documentElement.innerHTML = req.responseText;
|
||||
bq = threadID === replyID ? $('blockquote', doc) : $('blockquote', doc.getElementById(replyID));
|
||||
$.replace(a.parentNode.parentNode, bq);
|
||||
quotes = $$('.quotelink', bq);
|
||||
Threading.op($('body > form', doc).firstChild);
|
||||
bq = doc.getElementById(replyID).lastChild;
|
||||
tmp = $.el('div');
|
||||
$.add(tmp, bq);
|
||||
quotes = bq.getElementsByClassName('quotelink');
|
||||
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
|
||||
quote = quotes[_i];
|
||||
if (quote.getAttribute('href') === quote.hash) {
|
||||
if (quote.hash === quote.getAttribute('href')) {
|
||||
quote.pathname = "/" + g.BOARD + "/res/" + threadID;
|
||||
}
|
||||
}
|
||||
post = {
|
||||
el: bq.parentNode,
|
||||
threadId: threadID,
|
||||
quotes: bq.getElementsByClassName('quotelink'),
|
||||
quotes: quotes,
|
||||
backlinks: []
|
||||
};
|
||||
if (conf['Resurrect Quotes']) DeadQuotes.node(post);
|
||||
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);
|
||||
if (conf['Indicate Cross-thread Quotes']) QuoteCT.node(post);
|
||||
return $.replace(a.parentNode.parentNode, bq);
|
||||
}
|
||||
};
|
||||
|
||||
@ -3348,7 +3351,7 @@
|
||||
for (i = 0, _ref = snapshot.snapshotLength; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) {
|
||||
node = snapshot.snapshotItem(i);
|
||||
data = node.data;
|
||||
if (!(quotes = data.match(/>>(\d+|>\/[a-z\d]+\/\d+)/g))) continue;
|
||||
if (!(quotes = data.match(/>>(>\/[a-z\d]+\/)?\d+/g))) continue;
|
||||
nodes = [];
|
||||
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
|
||||
quote = quotes[_i];
|
||||
|
||||
@ -641,20 +641,22 @@ ExpandComment =
|
||||
doc = d.implementation.createHTMLDocument null
|
||||
doc.documentElement.innerHTML = req.responseText
|
||||
|
||||
bq =
|
||||
if threadID is replyID # OP
|
||||
$ 'blockquote', doc
|
||||
else
|
||||
$ 'blockquote', doc.getElementById replyID
|
||||
$.replace a.parentNode.parentNode, bq
|
||||
quotes = $$ '.quotelink', bq
|
||||
Threading.op $('body > form', doc).firstChild
|
||||
bq = doc.getElementById(replyID).lastChild
|
||||
|
||||
# Add the bq in a temporary element to fix quote.hashes
|
||||
# as they're empty when in a different document.
|
||||
tmp = $.el 'div'
|
||||
$.add tmp, bq
|
||||
|
||||
quotes = bq.getElementsByClassName 'quotelink'
|
||||
for quote in quotes
|
||||
if quote.getAttribute('href') is quote.hash
|
||||
if quote.hash is quote.getAttribute 'href'
|
||||
quote.pathname = "/#{g.BOARD}/res/#{threadID}"
|
||||
post =
|
||||
el: bq.parentNode
|
||||
threadId: threadID
|
||||
quotes: bq.getElementsByClassName 'quotelink'
|
||||
quotes: quotes
|
||||
backlinks: []
|
||||
if conf['Resurrect Quotes']
|
||||
DeadQuotes.node post
|
||||
@ -666,6 +668,7 @@ ExpandComment =
|
||||
QuoteOP.node post
|
||||
if conf['Indicate Cross-thread Quotes']
|
||||
QuoteCT.node post
|
||||
$.replace a.parentNode.parentNode, bq
|
||||
|
||||
ExpandThread =
|
||||
init: ->
|
||||
@ -2782,7 +2785,7 @@ DeadQuotes =
|
||||
node = snapshot.snapshotItem i
|
||||
data = node.data
|
||||
|
||||
unless quotes = data.match />>(\d+|>\/[a-z\d]+\/\d+)/g
|
||||
unless quotes = data.match />>(>\/[a-z\d]+\/)?\d+/g
|
||||
# Only accept nodes with potentially valid links
|
||||
continue
|
||||
|
||||
@ -2802,7 +2805,7 @@ DeadQuotes =
|
||||
else
|
||||
# TODO manage links if board is archived
|
||||
# Here be archive link
|
||||
href = "#"
|
||||
href = "#"
|
||||
className = null
|
||||
|
||||
nodes.push $.el 'a',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user