Fix contracting replies when contracting a thread too. #764

This commit is contained in:
Nicolas Stepien 2013-02-23 01:32:15 +01:00
parent 7d9172d55d
commit 90eace9fcb
2 changed files with 19 additions and 9 deletions

View File

@ -4720,7 +4720,7 @@
if (!post.nodes.shortComment) {
return;
}
a = a = $('.abbr > a', post.nodes.shortComment);
a = $('.abbr > a', post.nodes.shortComment);
a.textContent = 'here';
$.replace(post.nodes.longComment, post.nodes.shortComment);
return post.nodes.comment = post.nodes.shortComment;
@ -4815,7 +4815,7 @@
return ExpandThread.toggle(op.thread);
},
toggle: function(thread) {
var a, inlined, num, replies, reply, text, threadRoot, url, _i, _len;
var a, inlined, num, post, replies, reply, text, threadRoot, url, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
threadRoot = thread.OP.nodes.root.parentNode;
url = "//api.4chan.org/" + thread.board + "/res/" + thread + ".json";
a = $('.summary', threadRoot);
@ -4826,14 +4826,17 @@
$.cache(url, function() {
return ExpandThread.parse(this, thread, a);
});
ExpandComment.expand(thread.OP);
_ref = $$('.thread > .postContainer', threadRoot);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
post = _ref[_i];
ExpandComment.expand(Get.postFromRoot(post));
}
break;
case '×':
a.textContent = text.replace('× Loading...', '+');
break;
case '-':
a.textContent = text.replace('-', '+');
ExpandComment.contract(thread.OP);
num = (function() {
if (thread.isSticky) {
return 1;
@ -4851,8 +4854,8 @@
}
})();
replies = $$('.thread > .replyContainer', threadRoot).slice(0, -num);
for (_i = 0, _len = replies.length; _i < _len; _i++) {
reply = replies[_i];
for (_j = 0, _len1 = replies.length; _j < _len1; _j++) {
reply = replies[_j];
if (Conf['Quote Inlining']) {
while (inlined = $('.inlined', reply)) {
inlined.click();
@ -4860,6 +4863,11 @@
}
$.rm(reply);
}
_ref1 = $$('.thread > .postContainer', threadRoot);
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
post = _ref1[_k];
ExpandComment.contract(Get.postFromRoot(post));
}
}
},
parse: function(req, thread, a) {

View File

@ -3127,7 +3127,7 @@ ExpandComment =
$.cache "//api.4chan.org#{a.pathname}.json", -> ExpandComment.parse @, a, post
contract: (post) ->
return unless post.nodes.shortComment
a = a = $ '.abbr > a', post.nodes.shortComment
a = $ '.abbr > a', post.nodes.shortComment
a.textContent = 'here'
$.replace post.nodes.longComment, post.nodes.shortComment
post.nodes.comment = post.nodes.shortComment
@ -3203,14 +3203,14 @@ ExpandThread =
when '+'
a.textContent = text.replace '+', '× Loading...'
$.cache url, -> ExpandThread.parse @, thread, a
ExpandComment.expand thread.OP
for post in $$ '.thread > .postContainer', threadRoot
ExpandComment.expand Get.postFromRoot post
when '×'
a.textContent = text.replace '× Loading...', '+'
when '-'
a.textContent = text.replace '-', '+'
ExpandComment.contract thread.OP
#goddamit moot
num = if thread.isSticky
1
@ -3225,6 +3225,8 @@ ExpandThread =
# rm clones
inlined.click() while inlined = $ '.inlined', reply
$.rm reply
for post in $$ '.thread > .postContainer', threadRoot
ExpandComment.contract Get.postFromRoot post
return
parse: (req, thread, a) ->