This should fix Comment Expansion.
This commit is contained in:
parent
755a21ac01
commit
e52ee68c97
@ -762,18 +762,17 @@
|
||||
ExpandComment = {
|
||||
init: function() {
|
||||
var a, _i, _len, _ref;
|
||||
_ref = $$('.abbr > a');
|
||||
_ref = $$('.abbr');
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
a = _ref[_i];
|
||||
$.on(a, 'click', ExpandComment.expand);
|
||||
$.on(a.firstElementChild, 'click', ExpandComment.expand);
|
||||
}
|
||||
},
|
||||
expand: function(e) {
|
||||
var a, replyID, threadID, _, _ref;
|
||||
e.preventDefault();
|
||||
_ref = this.href.match(/(\d+)#(\d+)/), _ = _ref[0], threadID = _ref[1], replyID = _ref[2];
|
||||
_ref = this.href.match(/(\d+)#p(\d+)/), _ = _ref[0], threadID = _ref[1], replyID = _ref[2];
|
||||
this.textContent = "Loading " + replyID + "...";
|
||||
threadID = this.pathname.split('/').pop() || $.x('ancestor::div[@class="thread"]/div', this).id;
|
||||
a = this;
|
||||
return $.cache(this.pathname, (function() {
|
||||
return ExpandComment.parse(this, a, threadID, replyID);
|
||||
@ -787,7 +786,7 @@
|
||||
}
|
||||
doc = d.implementation.createHTMLDocument('');
|
||||
doc.documentElement.innerHTML = req.response;
|
||||
node = d.importNode(doc.getElementById(replyID));
|
||||
node = d.importNode(doc.getElementById("m" + replyID));
|
||||
quotes = node.getElementsByClassName('quotelink');
|
||||
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
|
||||
quote = quotes[_i];
|
||||
@ -818,7 +817,7 @@
|
||||
if (Conf['Indicate Cross-thread Quotes']) {
|
||||
QuoteCT.node(post);
|
||||
}
|
||||
return $.replace(a.parentNode.parentNode, node.lastChild);
|
||||
return $.replace(a.parentNode.parentNode, node);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -609,14 +609,13 @@ StrikethroughQuotes =
|
||||
|
||||
ExpandComment =
|
||||
init: ->
|
||||
for a in $$ '.abbr > a'
|
||||
$.on a, 'click', ExpandComment.expand
|
||||
for a in $$ '.abbr'
|
||||
$.on a.firstElementChild, 'click', ExpandComment.expand
|
||||
return
|
||||
expand: (e) ->
|
||||
e.preventDefault()
|
||||
[_, threadID, replyID] = @href.match /(\d+)#(\d+)/
|
||||
[_, threadID, replyID] = @href.match /(\d+)#p(\d+)/
|
||||
@textContent = "Loading #{replyID}..."
|
||||
threadID = @pathname.split('/').pop() or $.x('ancestor::div[@class="thread"]/div', @).id
|
||||
a = @
|
||||
$.cache @pathname, (-> ExpandComment.parse @, a, threadID, replyID)
|
||||
parse: (req, a, threadID, replyID) ->
|
||||
@ -629,12 +628,15 @@ ExpandComment =
|
||||
|
||||
# Import the node to fix quote.hashes
|
||||
# as they're empty when in a different document.
|
||||
node = d.importNode doc.getElementById replyID
|
||||
node = d.importNode doc.getElementById "m#{replyID}"
|
||||
|
||||
quotes = node.getElementsByClassName 'quotelink'
|
||||
for quote in quotes
|
||||
if quote.hash is href = quote.getAttribute 'href' # Add pathname to in-thread quotes
|
||||
quote.pathname = "/#{g.BOARD}/res/#{threadID}"
|
||||
# NEW HTML ???
|
||||
# OP quotes have different href attribute than normal quotes.
|
||||
# Waiting for a reply from moot.
|
||||
else if href isnt quote.href # Fix cross-thread links, not cross-board ones
|
||||
quote.href = "res/#{href}"
|
||||
post =
|
||||
@ -652,7 +654,7 @@ ExpandComment =
|
||||
QuoteOP.node post
|
||||
if Conf['Indicate Cross-thread Quotes']
|
||||
QuoteCT.node post
|
||||
$.replace a.parentNode.parentNode, node.lastChild
|
||||
$.replace a.parentNode.parentNode, node
|
||||
|
||||
ExpandThread =
|
||||
init: ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user