Update Thread and Comment Expansion.
This commit is contained in:
parent
bce07659a0
commit
b8e953d4ae
@ -770,9 +770,9 @@
|
||||
_ref = this.href.match(/(\d+)#p(\d+)/), _ = _ref[0], threadID = _ref[1], replyID = _ref[2];
|
||||
this.textContent = "Loading " + replyID + "...";
|
||||
a = this;
|
||||
return $.cache(this.pathname, (function() {
|
||||
return $.cache(this.pathname, function() {
|
||||
return ExpandComment.parse(this, a, threadID, replyID);
|
||||
}));
|
||||
});
|
||||
},
|
||||
parse: function(req, a, threadID, replyID) {
|
||||
var doc, href, node, post, quote, quotes, _i, _len;
|
||||
@ -786,11 +786,11 @@
|
||||
quotes = node.getElementsByClassName('quotelink');
|
||||
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
|
||||
quote = quotes[_i];
|
||||
if (quote.hash === (href = quote.getAttribute('href'))) {
|
||||
quote.pathname = "/" + g.BOARD + "/res/" + threadID;
|
||||
} else if (href !== quote.href) {
|
||||
quote.href = "res/" + href;
|
||||
href = quote.getAttribute('href');
|
||||
if (href[0] === '/') {
|
||||
continue;
|
||||
}
|
||||
quote.href = "res/" + href;
|
||||
}
|
||||
post = {
|
||||
el: node,
|
||||
@ -846,9 +846,9 @@
|
||||
$.rm(container);
|
||||
}
|
||||
a.textContent = a.textContent.replace('+', '\u00d7 Loading...');
|
||||
return $.cache(pathname, (function() {
|
||||
return $.cache(pathname, function() {
|
||||
return ExpandThread.parse(this, pathname, thread, a);
|
||||
}));
|
||||
});
|
||||
case '\u00d7':
|
||||
a.textContent = a.textContent.replace('\u00d7 Loading...', '+');
|
||||
return $.cache.requests[pathname].abort();
|
||||
@ -902,11 +902,10 @@
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
quote = _ref1[_j];
|
||||
href = quote.getAttribute('href');
|
||||
if (quote.hash === href) {
|
||||
quote.pathname = pathname;
|
||||
} else if (href !== quote.href) {
|
||||
quote.href = "res/" + href;
|
||||
if (href[0] === '/') {
|
||||
continue;
|
||||
}
|
||||
quote.href = "res/" + href;
|
||||
}
|
||||
id = reply.firstElementChild.id.slice(2);
|
||||
link = $('.postNum.desktop', reply).firstElementChild;
|
||||
|
||||
@ -614,7 +614,7 @@ ExpandComment =
|
||||
[_, threadID, replyID] = @href.match /(\d+)#p(\d+)/
|
||||
@textContent = "Loading #{replyID}..."
|
||||
a = @
|
||||
$.cache @pathname, (-> ExpandComment.parse @, a, threadID, replyID)
|
||||
$.cache @pathname, -> ExpandComment.parse @, a, threadID, replyID
|
||||
parse: (req, a, threadID, replyID) ->
|
||||
if req.status isnt 200
|
||||
a.textContent = "#{req.status} #{req.statusText}"
|
||||
@ -629,13 +629,9 @@ ExpandComment =
|
||||
|
||||
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}"
|
||||
href = quote.getAttribute 'href'
|
||||
continue if href[0] is '/' # Cross-board quote
|
||||
quote.href = "res/#{href}" # Fix pathnames
|
||||
post =
|
||||
el: node
|
||||
threadId: threadID
|
||||
@ -674,7 +670,7 @@ ExpandThread =
|
||||
if container = $ '.container', thread.firstElementChild
|
||||
$.rm container
|
||||
a.textContent = a.textContent.replace '+', '\u00d7 Loading...'
|
||||
$.cache pathname, (-> ExpandThread.parse @, pathname, thread, a)
|
||||
$.cache pathname, -> ExpandThread.parse @, pathname, thread, a
|
||||
|
||||
when '\u00d7'
|
||||
a.textContent = a.textContent.replace '\u00d7 Loading...', '+'
|
||||
@ -711,13 +707,8 @@ ExpandThread =
|
||||
reply = d.importNode reply
|
||||
for quote in $$ '.quotelink', reply
|
||||
href = quote.getAttribute 'href'
|
||||
if quote.hash is href # Add pathname to in-thread quotes
|
||||
quote.pathname = pathname
|
||||
# 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}"
|
||||
continue if href[0] is '/' # Cross-board quote
|
||||
quote.href = "res/#{href}" # Fix pathnames
|
||||
id = reply.firstElementChild.id[2..]
|
||||
link = $('.postNum.desktop', reply).firstElementChild
|
||||
link.href = "res/#{threadID}#p#{id}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user