Merge branch 'v3'

Conflicts:
	builds/appchan-x.user.js
	builds/crx/script.js
	src/General/Main.coffee
This commit is contained in:
Zixaphir 2014-01-07 10:26:51 -07:00
commit 7cf2bfc607
6 changed files with 183 additions and 222 deletions

View File

@ -3901,19 +3901,6 @@
} }
}; };
RandomAccessList.prototype.closest = function(ID) {
var item, prev;
item = this.first;
while (item) {
if (item.ID > ID) {
prev = item.prev;
break;
}
item = item.next;
}
return (prev ? prev.ID : -1);
};
return RandomAccessList; return RandomAccessList;
})(); })();
@ -7234,16 +7221,18 @@
}); });
}, },
setup: function() { setup: function() {
var ID, post, _ref;
$.off(d, '4chanXInitFinished', QuoteThreading.setup); $.off(d, '4chanXInitFinished', QuoteThreading.setup);
return QuoteThreading.force();
},
force: function() {
var ID, post, _ref;
_ref = g.posts; _ref = g.posts;
for (ID in _ref) { for (ID in _ref) {
post = _ref[ID]; post = _ref[ID];
if (post.cb) { if (post.cb) {
post.cb(); post.cb(true);
} }
} }
return QuoteThreading.hasRun = true;
}, },
node: function() { node: function() {
var keys, len, post, posts, quote, _i, _len, _ref; var keys, len, post, posts, quote, _i, _len, _ref;
@ -7272,82 +7261,78 @@
this.threaded = keys[0]; this.threaded = keys[0];
return this.cb = QuoteThreading.nodeinsert; return this.cb = QuoteThreading.nodeinsert;
}, },
nodeinsert: function() { nodeinsert: function(force) {
var ID, bottom, height, post, posts, root, threadContainer, top, _ref; var bottom, height, post, posts, root, threadContainer, top, _ref;
post = g.posts[this.threaded]; post = g.posts[this.threaded];
posts = Unread.posts;
if (this.thread.OP === post) { if (this.thread.OP === post) {
return false; return false;
} }
if (QuoteThreading.hasRun) { posts = Unread.posts;
root = post.nodes.root;
if (!force) {
height = doc.clientHeight; height = doc.clientHeight;
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; _ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) { if (!((Conf['Unread Count'] && posts[post.ID]) || ((bottom < height) && (top > 0)))) {
return false; return false;
} }
} }
root = post.nodes.root; if ($.hasClass(root, 'threadOP')) {
if (!$.hasClass(root, 'threadOP')) { threadContainer = root.nextElementSibling;
$.addClass(root, 'threadOP'); post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer));
$.add(threadContainer, this.nodes.root);
} else {
threadContainer = $.el('div', { threadContainer = $.el('div', {
className: 'threadContainer' className: 'threadContainer'
}); });
$.add(threadContainer, this.nodes.root);
$.after(root, threadContainer); $.after(root, threadContainer);
} else { $.addClass(root, 'threadOP');
threadContainer = root.nextSibling;
post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer));
} }
$.add(threadContainer, this.nodes.root);
if (!Conf['Unread Count']) { if (!Conf['Unread Count']) {
return true; return true;
} }
if (posts[post.ID]) { if (posts[post.ID]) {
posts.after(post, this); posts.after(post, this);
return true;
}
if ((ID = posts.closest(post.ID)) !== -1) {
posts.after(posts[ID], this);
} else { } else {
posts.prepend(this); posts.prepend(this);
} }
return true; return true;
}, },
toggle: function() { toggle: function() {
var container, containers, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref; var ID, container, containers, nodes, post, posts, thread, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _results;
if (Conf['Unread Count']) {
Unread.posts = new RandomAccessList;
Unread.ready();
}
thread = $('.thread');
replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread);
if (QuoteThreading.enabled = this.checked) { if (QuoteThreading.enabled = this.checked) {
QuoteThreading.hasRun = false; return QuoteThreading.force();
for (_i = 0, _len = replies.length; _i < _len; _i++) { } else {
reply = replies[_i]; thread = $('.thread');
post = Get.postFromRoot(reply); posts = [];
if (post.cb) { nodes = [];
post.cb(); _ref = g.posts;
for (ID in _ref) {
post = _ref[ID];
if (!(post === post.thread.OP || post.isClone)) {
posts.push(post);
} }
} }
QuoteThreading.hasRun = true; posts.sort(function(a, b) {
} else { return a.ID - b.ID;
replies.sort(function(a, b) {
return Number(a.id.slice(2)) - Number(b.id.slice(2));
}); });
$.add(thread, replies); for (_i = 0, _len = posts.length; _i < _len; _i++) {
post = posts[_i];
nodes.push(post.nodes.root);
}
$.add(thread, nodes);
containers = $$('.threadContainer', thread); containers = $$('.threadContainer', thread);
for (_j = 0, _len1 = containers.length; _j < _len1; _j++) { for (_j = 0, _len1 = containers.length; _j < _len1; _j++) {
container = containers[_j]; container = containers[_j];
$.rm(container); $.rm(container);
} }
_ref = $$('.threadOP'); _ref1 = $$('.threadOP');
for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) { _results = [];
post = _ref[_k]; for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
$.rmClass(post, 'threadOP'); post = _ref1[_k];
_results.push($.rmClass(post, 'threadOP'));
} }
} return _results;
if (Conf['Unread Count']) {
return Unread.read();
} }
}, },
kb: function() { kb: function() {
@ -11852,7 +11837,7 @@
} }
Unread.addPosts(posts); Unread.addPosts(posts);
if (Conf['Quote Threading']) { if (Conf['Quote Threading']) {
QuoteThreading.setup(); QuoteThreading.force();
} }
if (Conf['Scroll to Last Read Post']) { if (Conf['Scroll to Last Read Post']) {
return Unread.scroll(); return Unread.scroll();
@ -16495,7 +16480,25 @@
Main = { Main = {
init: function() { init: function() {
var db, flatten, _i, _len, _ref; var db, flatten, pathname, _i, _len, _ref, _ref1;
pathname = location.pathname.split('/');
g.BOARD = new Board(pathname[1]);
if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') {
return;
}
g.VIEW = (function() {
switch (pathname[2]) {
case 'res':
return 'thread';
case 'catalog':
return 'catalog';
default:
return 'index';
}
})();
if (g.VIEW === 'thread') {
g.THREADID = +pathname[3];
}
flatten = function(parent, obj) { flatten = function(parent, obj) {
var key, val; var key, val;
if (obj instanceof Array) { if (obj instanceof Array) {
@ -16510,9 +16513,9 @@
} }
}; };
flatten(null, Config); flatten(null, Config);
_ref = DataBoard.keys; _ref1 = DataBoard.keys;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
db = _ref[_i]; db = _ref1[_i];
Conf[db] = { Conf[db] = {
boards: {} boards: {}
}; };
@ -16540,22 +16543,7 @@
}); });
}, },
initFeatures: function() { initFeatures: function() {
var init, pathname, _ref, _ref1; var init, _ref, _ref1;
pathname = location.pathname.split('/');
g.BOARD = new Board(pathname[1]);
g.VIEW = (function() {
switch (pathname[2]) {
case 'res':
return 'thread';
case 'catalog':
return 'catalog';
default:
return 'index';
}
})();
if (g.VIEW === 'thread') {
g.THREADID = +pathname[3];
}
g.TYPE = (_ref = g.BOARD.ID) === 'b' || _ref === 'd' || _ref === 'e' || _ref === 'gif' || _ref === 'h' || _ref === 'hc' || _ref === 'hm' || _ref === 'hr' || _ref === 'pol' || _ref === 'r' || _ref === 'r9k' || _ref === 'rs' || _ref === 's' || _ref === 's4s' || _ref === 'soc' || _ref === 't' || _ref === 'u' || _ref === 'y' ? 'nsfw' : 'sfw'; g.TYPE = (_ref = g.BOARD.ID) === 'b' || _ref === 'd' || _ref === 'e' || _ref === 'gif' || _ref === 'h' || _ref === 'hc' || _ref === 'hm' || _ref === 'hr' || _ref === 'pol' || _ref === 'r' || _ref === 'r9k' || _ref === 'rs' || _ref === 's' || _ref === 's4s' || _ref === 'soc' || _ref === 't' || _ref === 'u' || _ref === 'y' ? 'nsfw' : 'sfw';
$.extend(Themes, Conf["userThemes"]); $.extend(Themes, Conf["userThemes"]);
$.extend(Mascots, Conf["userMascots"]); $.extend(Mascots, Conf["userMascots"]);
@ -16585,7 +16573,7 @@
return; return;
case 'i.4cdn.org': case 'i.4cdn.org':
$.ready(function() { $.ready(function() {
var URL, _ref2; var URL, pathname, _ref2;
if (Conf['404 Redirect'] && ((_ref2 = d.title) === '4chan - Temporarily Offline' || _ref2 === '4chan - 404 Not Found')) { if (Conf['404 Redirect'] && ((_ref2 = d.title) === '4chan - Temporarily Offline' || _ref2 === '4chan - 404 Not Found')) {
Redirect.init(); Redirect.init();
pathname = location.pathname.split('/'); pathname = location.pathname.split('/');

View File

@ -3908,19 +3908,6 @@
} }
}; };
RandomAccessList.prototype.closest = function(ID) {
var item, prev;
item = this.first;
while (item) {
if (item.ID > ID) {
prev = item.prev;
break;
}
item = item.next;
}
return (prev ? prev.ID : -1);
};
return RandomAccessList; return RandomAccessList;
})(); })();
@ -7238,16 +7225,18 @@
}); });
}, },
setup: function() { setup: function() {
var ID, post, _ref;
$.off(d, '4chanXInitFinished', QuoteThreading.setup); $.off(d, '4chanXInitFinished', QuoteThreading.setup);
return QuoteThreading.force();
},
force: function() {
var ID, post, _ref;
_ref = g.posts; _ref = g.posts;
for (ID in _ref) { for (ID in _ref) {
post = _ref[ID]; post = _ref[ID];
if (post.cb) { if (post.cb) {
post.cb(); post.cb(true);
} }
} }
return QuoteThreading.hasRun = true;
}, },
node: function() { node: function() {
var keys, len, post, posts, quote, _i, _len, _ref; var keys, len, post, posts, quote, _i, _len, _ref;
@ -7276,82 +7265,78 @@
this.threaded = keys[0]; this.threaded = keys[0];
return this.cb = QuoteThreading.nodeinsert; return this.cb = QuoteThreading.nodeinsert;
}, },
nodeinsert: function() { nodeinsert: function(force) {
var ID, bottom, height, post, posts, root, threadContainer, top, _ref; var bottom, height, post, posts, root, threadContainer, top, _ref;
post = g.posts[this.threaded]; post = g.posts[this.threaded];
posts = Unread.posts;
if (this.thread.OP === post) { if (this.thread.OP === post) {
return false; return false;
} }
if (QuoteThreading.hasRun) { posts = Unread.posts;
root = post.nodes.root;
if (!force) {
height = doc.clientHeight; height = doc.clientHeight;
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; _ref = root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) { if (!((Conf['Unread Count'] && posts[post.ID]) || ((bottom < height) && (top > 0)))) {
return false; return false;
} }
} }
root = post.nodes.root; if ($.hasClass(root, 'threadOP')) {
if (!$.hasClass(root, 'threadOP')) { threadContainer = root.nextElementSibling;
$.addClass(root, 'threadOP'); post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer));
$.add(threadContainer, this.nodes.root);
} else {
threadContainer = $.el('div', { threadContainer = $.el('div', {
className: 'threadContainer' className: 'threadContainer'
}); });
$.add(threadContainer, this.nodes.root);
$.after(root, threadContainer); $.after(root, threadContainer);
} else { $.addClass(root, 'threadOP');
threadContainer = root.nextSibling;
post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer));
} }
$.add(threadContainer, this.nodes.root);
if (!Conf['Unread Count']) { if (!Conf['Unread Count']) {
return true; return true;
} }
if (posts[post.ID]) { if (posts[post.ID]) {
posts.after(post, this); posts.after(post, this);
return true;
}
if ((ID = posts.closest(post.ID)) !== -1) {
posts.after(posts[ID], this);
} else { } else {
posts.prepend(this); posts.prepend(this);
} }
return true; return true;
}, },
toggle: function() { toggle: function() {
var container, containers, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref; var ID, container, containers, nodes, post, posts, thread, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _results;
if (Conf['Unread Count']) {
Unread.posts = new RandomAccessList;
Unread.ready();
}
thread = $('.thread');
replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread);
if (QuoteThreading.enabled = this.checked) { if (QuoteThreading.enabled = this.checked) {
QuoteThreading.hasRun = false; return QuoteThreading.force();
for (_i = 0, _len = replies.length; _i < _len; _i++) { } else {
reply = replies[_i]; thread = $('.thread');
post = Get.postFromRoot(reply); posts = [];
if (post.cb) { nodes = [];
post.cb(); _ref = g.posts;
for (ID in _ref) {
post = _ref[ID];
if (!(post === post.thread.OP || post.isClone)) {
posts.push(post);
} }
} }
QuoteThreading.hasRun = true; posts.sort(function(a, b) {
} else { return a.ID - b.ID;
replies.sort(function(a, b) {
return Number(a.id.slice(2)) - Number(b.id.slice(2));
}); });
$.add(thread, replies); for (_i = 0, _len = posts.length; _i < _len; _i++) {
post = posts[_i];
nodes.push(post.nodes.root);
}
$.add(thread, nodes);
containers = $$('.threadContainer', thread); containers = $$('.threadContainer', thread);
for (_j = 0, _len1 = containers.length; _j < _len1; _j++) { for (_j = 0, _len1 = containers.length; _j < _len1; _j++) {
container = containers[_j]; container = containers[_j];
$.rm(container); $.rm(container);
} }
_ref = $$('.threadOP'); _ref1 = $$('.threadOP');
for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) { _results = [];
post = _ref[_k]; for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
$.rmClass(post, 'threadOP'); post = _ref1[_k];
_results.push($.rmClass(post, 'threadOP'));
} }
} return _results;
if (Conf['Unread Count']) {
return Unread.read();
} }
}, },
kb: function() { kb: function() {
@ -11836,7 +11821,7 @@
} }
Unread.addPosts(posts); Unread.addPosts(posts);
if (Conf['Quote Threading']) { if (Conf['Quote Threading']) {
QuoteThreading.setup(); QuoteThreading.force();
} }
if (Conf['Scroll to Last Read Post']) { if (Conf['Scroll to Last Read Post']) {
return Unread.scroll(); return Unread.scroll();
@ -16483,7 +16468,25 @@
Main = { Main = {
init: function() { init: function() {
var db, flatten, _i, _len, _ref; var db, flatten, pathname, _i, _len, _ref, _ref1;
pathname = location.pathname.split('/');
g.BOARD = new Board(pathname[1]);
if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') {
return;
}
g.VIEW = (function() {
switch (pathname[2]) {
case 'res':
return 'thread';
case 'catalog':
return 'catalog';
default:
return 'index';
}
})();
if (g.VIEW === 'thread') {
g.THREADID = +pathname[3];
}
flatten = function(parent, obj) { flatten = function(parent, obj) {
var key, val; var key, val;
if (obj instanceof Array) { if (obj instanceof Array) {
@ -16498,9 +16501,9 @@
} }
}; };
flatten(null, Config); flatten(null, Config);
_ref = DataBoard.keys; _ref1 = DataBoard.keys;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
db = _ref[_i]; db = _ref1[_i];
Conf[db] = { Conf[db] = {
boards: {} boards: {}
}; };
@ -16528,22 +16531,7 @@
}); });
}, },
initFeatures: function() { initFeatures: function() {
var init, pathname, _ref, _ref1; var init, _ref, _ref1;
pathname = location.pathname.split('/');
g.BOARD = new Board(pathname[1]);
g.VIEW = (function() {
switch (pathname[2]) {
case 'res':
return 'thread';
case 'catalog':
return 'catalog';
default:
return 'index';
}
})();
if (g.VIEW === 'thread') {
g.THREADID = +pathname[3];
}
g.TYPE = (_ref = g.BOARD.ID) === 'b' || _ref === 'd' || _ref === 'e' || _ref === 'gif' || _ref === 'h' || _ref === 'hc' || _ref === 'hm' || _ref === 'hr' || _ref === 'pol' || _ref === 'r' || _ref === 'r9k' || _ref === 'rs' || _ref === 's' || _ref === 's4s' || _ref === 'soc' || _ref === 't' || _ref === 'u' || _ref === 'y' ? 'nsfw' : 'sfw'; g.TYPE = (_ref = g.BOARD.ID) === 'b' || _ref === 'd' || _ref === 'e' || _ref === 'gif' || _ref === 'h' || _ref === 'hc' || _ref === 'hm' || _ref === 'hr' || _ref === 'pol' || _ref === 'r' || _ref === 'r9k' || _ref === 'rs' || _ref === 's' || _ref === 's4s' || _ref === 'soc' || _ref === 't' || _ref === 'u' || _ref === 'y' ? 'nsfw' : 'sfw';
$.extend(Themes, Conf["userThemes"]); $.extend(Themes, Conf["userThemes"]);
$.extend(Mascots, Conf["userMascots"]); $.extend(Mascots, Conf["userMascots"]);
@ -16573,7 +16561,7 @@
return; return;
case 'i.4cdn.org': case 'i.4cdn.org':
$.ready(function() { $.ready(function() {
var URL, _ref2; var URL, pathname, _ref2;
if (Conf['404 Redirect'] && ((_ref2 = d.title) === '4chan - Temporarily Offline' || _ref2 === '4chan - 404 Not Found')) { if (Conf['404 Redirect'] && ((_ref2 = d.title) === '4chan - Temporarily Offline' || _ref2 === '4chan - 404 Not Found')) {
Redirect.init(); Redirect.init();
pathname = location.pathname.split('/'); pathname = location.pathname.split('/');

View File

@ -1,5 +1,19 @@
Main = Main =
init: -> init: ->
pathname = location.pathname.split '/'
g.BOARD = new Board pathname[1]
return if g.BOARD.ID in ['z', 'fk']
g.VIEW =
switch pathname[2]
when 'res'
'thread'
when 'catalog'
'catalog'
else
'index'
if g.VIEW is 'thread'
g.THREADID = +pathname[3]
# flatten Config into Conf # flatten Config into Conf
# and get saved or default values # and get saved or default values
flatten = (parent, obj) -> flatten = (parent, obj) ->
@ -36,20 +50,6 @@ Main =
Main.initFeatures() Main.initFeatures()
initFeatures: -> initFeatures: ->
pathname = location.pathname.split '/'
g.BOARD = new Board pathname[1]
g.VIEW =
switch pathname[2]
when 'res'
'thread'
when 'catalog'
'catalog'
else
'index'
if g.VIEW is 'thread'
g.THREADID = +pathname[3]
# Check if the current board we're on is SFW or not, so we can handle options that need to know that. # Check if the current board we're on is SFW or not, so we can handle options that need to know that.
g.TYPE = g.TYPE =
if g.BOARD.ID in ['b', 'd', 'e', 'gif', 'h', 'hc', 'hm', 'hr', 'pol', 'r', 'r9k', 'rs', 's', 's4s', 'soc', 't', 'u', 'y'] if g.BOARD.ID in ['b', 'd', 'e', 'gif', 'h', 'hc', 'hm', 'hr', 'pol', 'r', 'r9k', 'rs', 's', 's4s', 'soc', 't', 'u', 'y']

View File

@ -56,12 +56,3 @@ class RandomAccessList
next.prev = prev next.prev = prev
else else
@last = prev @last = prev
closest: (ID) ->
item = @first
while item
if item.ID > ID
{prev} = item
break
item = item.next
return (if prev then prev.ID else -1)

View File

@ -39,7 +39,7 @@ Unread =
posts = [] posts = []
posts.push post for ID, post of Unread.thread.posts when post.isReply posts.push post for ID, post of Unread.thread.posts when post.isReply
Unread.addPosts posts Unread.addPosts posts
QuoteThreading.setup() if Conf['Quote Threading'] QuoteThreading.force() if Conf['Quote Threading']
Unread.scroll() if Conf['Scroll to Last Read Post'] Unread.scroll() if Conf['Scroll to Last Read Post']
scroll: -> scroll: ->

View File

@ -26,9 +26,11 @@ QuoteThreading =
setup: -> setup: ->
$.off d, '4chanXInitFinished', QuoteThreading.setup $.off d, '4chanXInitFinished', QuoteThreading.setup
QuoteThreading.force()
post.cb() for ID, post of g.posts when post.cb force: ->
QuoteThreading.hasRun = true post.cb true for ID, post of g.posts when post.cb
return
node: -> node: ->
{posts} = g {posts} = g
@ -46,69 +48,61 @@ QuoteThreading =
@threaded = keys[0] @threaded = keys[0]
@cb = QuoteThreading.nodeinsert @cb = QuoteThreading.nodeinsert
nodeinsert: -> nodeinsert: (force) ->
post = g.posts[@threaded] post = g.posts[@threaded]
{posts} = Unread
return false if @thread.OP is post return false if @thread.OP is post
if QuoteThreading.hasRun {posts} = Unread
{root} = post.nodes
unless force
height = doc.clientHeight height = doc.clientHeight
{bottom, top} = post.nodes.root.getBoundingClientRect() {bottom, top} = root.getBoundingClientRect()
# Post is unread or is fully visible. # Post is unread or is fully visible.
return false unless posts?[post.ID] or ((bottom < height) and (top > 0)) return false unless (Conf['Unread Count'] and posts[post.ID]) or ((bottom < height) and (top > 0))
{root} = post.nodes if $.hasClass root, 'threadOP'
unless $.hasClass root, 'threadOP' threadContainer = root.nextElementSibling
$.addClass root, 'threadOP' post = Get.postFromRoot $.x 'descendant::div[contains(@class,"postContainer")][last()]', threadContainer
$.add threadContainer, @nodes.root
else
threadContainer = $.el 'div', threadContainer = $.el 'div',
className: 'threadContainer' className: 'threadContainer'
$.add threadContainer, @nodes.root
$.after root, threadContainer $.after root, threadContainer
else $.addClass root, 'threadOP'
threadContainer = root.nextSibling
post = Get.postFromRoot $.x 'descendant::div[contains(@class,"postContainer")][last()]', threadContainer
$.add threadContainer, @nodes.root
return true unless Conf['Unread Count'] return true unless Conf['Unread Count']
if posts[post.ID] if posts[post.ID]
posts.after post, @ posts.after post, @
return true
if (ID = posts.closest post.ID) isnt -1
posts.after posts[ID], @
else else
posts.prepend @ posts.prepend @
return true return true
toggle: -> toggle: ->
if Conf['Unread Count']
Unread.posts = new RandomAccessList
Unread.ready()
thread = $ '.thread'
replies = $$ '.thread > .replyContainer, .threadContainer > .replyContainer', thread
if QuoteThreading.enabled = @checked if QuoteThreading.enabled = @checked
QuoteThreading.hasRun = false QuoteThreading.force()
for reply in replies
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 else
replies.sort (a, b) -> Number(a.id[2..]) - Number(b.id[2..]) thread = $('.thread')
$.add thread, replies 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
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'
Unread.read() if Conf['Unread Count']
kb: -> kb: ->
control = $.id 'threadingControl' control = $.id 'threadingControl'