Fix toggle
This commit is contained in:
parent
3a776fb5e1
commit
a7ce01cb61
@ -5030,35 +5030,26 @@
|
||||
return true;
|
||||
},
|
||||
toggle: function() {
|
||||
var container, containers, node, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref;
|
||||
var container, containers, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref;
|
||||
if (Conf['Unread Count']) {
|
||||
Unread.posts = new RandomAccessList;
|
||||
Unread.ready();
|
||||
}
|
||||
thread = $('.thread');
|
||||
replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread);
|
||||
QuoteThreading.enabled = this.checked;
|
||||
if (this.checked) {
|
||||
if (QuoteThreading.enabled = this.checked) {
|
||||
QuoteThreading.hasRun = false;
|
||||
for (_i = 0, _len = replies.length; _i < _len; _i++) {
|
||||
reply = replies[_i];
|
||||
node = Get.postFromRoot(reply);
|
||||
if (node.cb) {
|
||||
node.cb();
|
||||
} else {
|
||||
QuoteThreading.node.call(node);
|
||||
if (node.cb) {
|
||||
node.cb();
|
||||
}
|
||||
post = Get.postFromRoot(reply);
|
||||
if (post.cb) {
|
||||
post.cb();
|
||||
}
|
||||
}
|
||||
QuoteThreading.hasRun = true;
|
||||
} else {
|
||||
replies.sort(function(a, b) {
|
||||
var aID, bID;
|
||||
aID = Number(a.id.slice(2));
|
||||
bID = Number(b.id.slice(2));
|
||||
return aID - bID;
|
||||
return Number(a.id.slice(2)) - Number(b.id.slice(2));
|
||||
});
|
||||
$.add(thread, replies);
|
||||
containers = $$('.threadContainer', thread);
|
||||
|
||||
@ -5033,35 +5033,26 @@
|
||||
return true;
|
||||
},
|
||||
toggle: function() {
|
||||
var container, containers, node, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref;
|
||||
var container, containers, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref;
|
||||
if (Conf['Unread Count']) {
|
||||
Unread.posts = new RandomAccessList;
|
||||
Unread.ready();
|
||||
}
|
||||
thread = $('.thread');
|
||||
replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread);
|
||||
QuoteThreading.enabled = this.checked;
|
||||
if (this.checked) {
|
||||
if (QuoteThreading.enabled = this.checked) {
|
||||
QuoteThreading.hasRun = false;
|
||||
for (_i = 0, _len = replies.length; _i < _len; _i++) {
|
||||
reply = replies[_i];
|
||||
node = Get.postFromRoot(reply);
|
||||
if (node.cb) {
|
||||
node.cb();
|
||||
} else {
|
||||
QuoteThreading.node.call(node);
|
||||
if (node.cb) {
|
||||
node.cb();
|
||||
}
|
||||
post = Get.postFromRoot(reply);
|
||||
if (post.cb) {
|
||||
post.cb();
|
||||
}
|
||||
}
|
||||
QuoteThreading.hasRun = true;
|
||||
} else {
|
||||
replies.sort(function(a, b) {
|
||||
var aID, bID;
|
||||
aID = Number(a.id.slice(2));
|
||||
bID = Number(b.id.slice(2));
|
||||
return aID - bID;
|
||||
return Number(a.id.slice(2)) - Number(b.id.slice(2));
|
||||
});
|
||||
$.add(thread, replies);
|
||||
containers = $$('.threadContainer', thread);
|
||||
|
||||
@ -28,7 +28,6 @@ QuoteThreading =
|
||||
$.off d, '4chanXInitFinished', QuoteThreading.setup
|
||||
|
||||
post.cb() for ID, post of g.posts when post.cb
|
||||
|
||||
QuoteThreading.hasRun = true
|
||||
|
||||
node: ->
|
||||
@ -92,22 +91,19 @@ QuoteThreading =
|
||||
|
||||
thread = $ '.thread'
|
||||
replies = $$ '.thread > .replyContainer, .threadContainer > .replyContainer', thread
|
||||
QuoteThreading.enabled = @checked
|
||||
if @checked
|
||||
|
||||
if QuoteThreading.enabled = @checked
|
||||
QuoteThreading.hasRun = false
|
||||
for reply in replies
|
||||
node = Get.postFromRoot reply
|
||||
if node.cb
|
||||
node.cb()
|
||||
else
|
||||
QuoteThreading.node.call node
|
||||
node.cb() if node.cb
|
||||
post = Get.postFromRoot reply
|
||||
# QuoteThreading calculates whether or not posts should be threaded based on content
|
||||
# and then threads them based on thread context, so regardless of whether or not it
|
||||
# actually threads them all eligible posts WILL have a cb. Magic.
|
||||
post.cb() if post.cb
|
||||
QuoteThreading.hasRun = true
|
||||
|
||||
else
|
||||
replies.sort (a, b) ->
|
||||
aID = Number a.id[2..]
|
||||
bID = Number b.id[2..]
|
||||
aID - bID
|
||||
replies.sort (a, b) -> Number(a.id[2..]) - Number(b.id[2..])
|
||||
$.add thread, replies
|
||||
containers = $$ '.threadContainer', thread
|
||||
$.rm container for container in containers
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user