That translates to leaner JS
This commit is contained in:
parent
420a5ad432
commit
898cfda2fd
@ -5016,44 +5016,37 @@
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var ID, container, containers, post, posts, thread, _i, _j, _len, _len1, _ref, _results;
|
var ID, container, containers, nodes, post, posts, thread, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _results;
|
||||||
if (QuoteThreading.enabled = this.checked) {
|
if (QuoteThreading.enabled = this.checked) {
|
||||||
return QuoteThreading.force();
|
return QuoteThreading.force();
|
||||||
} else {
|
} else {
|
||||||
thread = $('.thread');
|
thread = $('.thread');
|
||||||
posts = (function() {
|
posts = [];
|
||||||
var _ref, _results;
|
nodes = [];
|
||||||
_ref = g.posts;
|
_ref = g.posts;
|
||||||
_results = [];
|
for (ID in _ref) {
|
||||||
for (ID in _ref) {
|
post = _ref[ID];
|
||||||
post = _ref[ID];
|
if (!(post === post.thread.OP || post.isClone)) {
|
||||||
if (!(post === post.thread.OP || post.isClone)) {
|
posts.push(post);
|
||||||
_results.push(post);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return _results;
|
}
|
||||||
})();
|
|
||||||
posts.sort(function(a, b) {
|
posts.sort(function(a, b) {
|
||||||
return a.ID - b.ID;
|
return a.ID - b.ID;
|
||||||
});
|
});
|
||||||
$.add(thread, (function() {
|
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
||||||
var _i, _len, _results;
|
post = posts[_i];
|
||||||
_results = [];
|
nodes.push(post.nodes.root);
|
||||||
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
}
|
||||||
post = posts[_i];
|
$.add(thread, nodes);
|
||||||
_results.push(post.nodes.root);
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
})());
|
|
||||||
containers = $$('.threadContainer', thread);
|
containers = $$('.threadContainer', thread);
|
||||||
for (_i = 0, _len = containers.length; _i < _len; _i++) {
|
for (_j = 0, _len1 = containers.length; _j < _len1; _j++) {
|
||||||
container = containers[_i];
|
container = containers[_j];
|
||||||
$.rm(container);
|
$.rm(container);
|
||||||
}
|
}
|
||||||
_ref = $$('.threadOP');
|
_ref1 = $$('.threadOP');
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
|
||||||
post = _ref[_j];
|
post = _ref1[_k];
|
||||||
_results.push($.rmClass(post, 'threadOP'));
|
_results.push($.rmClass(post, 'threadOP'));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
|
|||||||
@ -5019,44 +5019,37 @@
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var ID, container, containers, post, posts, thread, _i, _j, _len, _len1, _ref, _results;
|
var ID, container, containers, nodes, post, posts, thread, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _results;
|
||||||
if (QuoteThreading.enabled = this.checked) {
|
if (QuoteThreading.enabled = this.checked) {
|
||||||
return QuoteThreading.force();
|
return QuoteThreading.force();
|
||||||
} else {
|
} else {
|
||||||
thread = $('.thread');
|
thread = $('.thread');
|
||||||
posts = (function() {
|
posts = [];
|
||||||
var _ref, _results;
|
nodes = [];
|
||||||
_ref = g.posts;
|
_ref = g.posts;
|
||||||
_results = [];
|
for (ID in _ref) {
|
||||||
for (ID in _ref) {
|
post = _ref[ID];
|
||||||
post = _ref[ID];
|
if (!(post === post.thread.OP || post.isClone)) {
|
||||||
if (!(post === post.thread.OP || post.isClone)) {
|
posts.push(post);
|
||||||
_results.push(post);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return _results;
|
}
|
||||||
})();
|
|
||||||
posts.sort(function(a, b) {
|
posts.sort(function(a, b) {
|
||||||
return a.ID - b.ID;
|
return a.ID - b.ID;
|
||||||
});
|
});
|
||||||
$.add(thread, (function() {
|
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
||||||
var _i, _len, _results;
|
post = posts[_i];
|
||||||
_results = [];
|
nodes.push(post.nodes.root);
|
||||||
for (_i = 0, _len = posts.length; _i < _len; _i++) {
|
}
|
||||||
post = posts[_i];
|
$.add(thread, nodes);
|
||||||
_results.push(post.nodes.root);
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
})());
|
|
||||||
containers = $$('.threadContainer', thread);
|
containers = $$('.threadContainer', thread);
|
||||||
for (_i = 0, _len = containers.length; _i < _len; _i++) {
|
for (_j = 0, _len1 = containers.length; _j < _len1; _j++) {
|
||||||
container = containers[_i];
|
container = containers[_j];
|
||||||
$.rm(container);
|
$.rm(container);
|
||||||
}
|
}
|
||||||
_ref = $$('.threadOP');
|
_ref1 = $$('.threadOP');
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
|
||||||
post = _ref[_j];
|
post = _ref1[_k];
|
||||||
_results.push($.rmClass(post, 'threadOP'));
|
_results.push($.rmClass(post, 'threadOP'));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
|
|||||||
@ -91,9 +91,15 @@ QuoteThreading =
|
|||||||
|
|
||||||
else
|
else
|
||||||
thread = $('.thread')
|
thread = $('.thread')
|
||||||
posts = (post for ID, post of g.posts when not (post is post.thread.OP or post.isClone))
|
posts = []
|
||||||
|
nodes = []
|
||||||
|
|
||||||
|
posts.push post for ID, post of g.posts when not (post is post.thread.OP or post.isClone)
|
||||||
posts.sort (a, b) -> a.ID - b.ID
|
posts.sort (a, b) -> a.ID - b.ID
|
||||||
$.add thread, (post.nodes.root for post in posts)
|
|
||||||
|
nodes.push post.nodes.root for post in posts
|
||||||
|
$.add thread, nodes
|
||||||
|
|
||||||
containers = $$ '.threadContainer', thread
|
containers = $$ '.threadContainer', thread
|
||||||
$.rm container for container in containers
|
$.rm container for container in containers
|
||||||
$.rmClass post, 'threadOP' for post in $$ '.threadOP'
|
$.rmClass post, 'threadOP' for post in $$ '.threadOP'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user