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