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