diff --git a/LICENSE b/LICENSE index 2c45a1757..8331083f3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.2.1 - 2013-07-29 +* appchan x - Version 2.2.1 - 2013-07-31 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 8711b89f2..76df67523 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -19,7 +19,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.2.24 - 2013-07-29 +* 4chan X - Version 1.2.24 - 2013-07-31 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -4084,10 +4084,9 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var bottom, height, posts, qpost, qroot, threadContainer, top, _ref; + var bottom, height, qpost, qroot, threadContainer, top, _ref; - posts = g.posts; - qpost = posts[this.threaded]; + qpost = g.posts[this.threaded]; delete this.threaded; delete this.cb; if (this.thread.OP === qpost) { @@ -4114,26 +4113,21 @@ return true; }, toggle: function() { - var container, containers, node, nodes, replies, reply, thread, _i, _j, _len, _len1; + var container, containers, node, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref; thread = $('.thread'); replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread); QuoteThreading.enabled = this.checked; if (this.checked) { - nodes = (function() { - var _i, _len, _results; - - _results = []; - for (_i = 0, _len = replies.length; _i < _len; _i++) { - reply = replies[_i]; - _results.push(Get.postFromNode(reply)); + QuoteThreading.hasRun = false; + for (_i = 0, _len = replies.length; _i < _len; _i++) { + reply = replies[_i]; + QuoteThreading.node.call(node = Get.postFromRoot(reply)); + if (node.cb) { + node.cb(); } - return _results; - })(); - for (_i = 0, _len = nodes.length; _i < _len; _i++) { - node = nodes[_i]; - QuoteThreading.node(node); } + QuoteThreading.hasRun = true; } else { replies.sort(function(a, b) { var aID, bID; @@ -4148,8 +4142,13 @@ container = containers[_j]; $.rm(container); } - Unread.update(true); + _ref = $$('.threadOP'); + for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) { + post = _ref[_k]; + $.rmClass(post, 'threadOP'); + } } + return Unread.update(true); }, kb: function() { var control; diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 9c64573b3..9f10a4db5 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -18,7 +18,7 @@ // ==/UserScript== /* -* appchan x - Version 2.2.1 - 2013-07-29 +* appchan x - Version 2.2.1 - 2013-07-31 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -6377,10 +6377,9 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var bottom, height, posts, qpost, qroot, threadContainer, top, _ref; + var bottom, height, qpost, qroot, threadContainer, top, _ref; - posts = g.posts; - qpost = posts[this.threaded]; + qpost = g.posts[this.threaded]; delete this.threaded; delete this.cb; if (this.thread.OP === qpost) { @@ -6407,26 +6406,21 @@ return true; }, toggle: function() { - var container, containers, node, nodes, replies, reply, thread, _i, _j, _len, _len1; + var container, containers, node, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref; thread = $('.thread'); replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread); QuoteThreading.enabled = this.checked; if (this.checked) { - nodes = (function() { - var _i, _len, _results; - - _results = []; - for (_i = 0, _len = replies.length; _i < _len; _i++) { - reply = replies[_i]; - _results.push(Get.postFromNode(reply)); + QuoteThreading.hasRun = false; + for (_i = 0, _len = replies.length; _i < _len; _i++) { + reply = replies[_i]; + QuoteThreading.node.call(node = Get.postFromRoot(reply)); + if (node.cb) { + node.cb(); } - return _results; - })(); - for (_i = 0, _len = nodes.length; _i < _len; _i++) { - node = nodes[_i]; - QuoteThreading.node(node); } + QuoteThreading.hasRun = true; } else { replies.sort(function(a, b) { var aID, bID; @@ -6441,8 +6435,13 @@ container = containers[_j]; $.rm(container); } - Unread.update(true); + _ref = $$('.threadOP'); + for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) { + post = _ref[_k]; + $.rmClass(post, 'threadOP'); + } } + return Unread.update(true); }, kb: function() { var control; diff --git a/builds/crx/script.js b/builds/crx/script.js index 5d60d6703..c26f82623 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.2.1 - 2013-07-29 +* appchan x - Version 2.2.1 - 2013-07-31 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -6378,10 +6378,9 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var bottom, height, posts, qpost, qroot, threadContainer, top, _ref; + var bottom, height, qpost, qroot, threadContainer, top, _ref; - posts = g.posts; - qpost = posts[this.threaded]; + qpost = g.posts[this.threaded]; delete this.threaded; delete this.cb; if (this.thread.OP === qpost) { @@ -6408,26 +6407,21 @@ return true; }, toggle: function() { - var container, containers, node, nodes, replies, reply, thread, _i, _j, _len, _len1; + var container, containers, node, post, replies, reply, thread, _i, _j, _k, _len, _len1, _len2, _ref; thread = $('.thread'); replies = $$('.thread > .replyContainer, .threadContainer > .replyContainer', thread); QuoteThreading.enabled = this.checked; if (this.checked) { - nodes = (function() { - var _i, _len, _results; - - _results = []; - for (_i = 0, _len = replies.length; _i < _len; _i++) { - reply = replies[_i]; - _results.push(Get.postFromNode(reply)); + QuoteThreading.hasRun = false; + for (_i = 0, _len = replies.length; _i < _len; _i++) { + reply = replies[_i]; + QuoteThreading.node.call(node = Get.postFromRoot(reply)); + if (node.cb) { + node.cb(); } - return _results; - })(); - for (_i = 0, _len = nodes.length; _i < _len; _i++) { - node = nodes[_i]; - QuoteThreading.node(node); } + QuoteThreading.hasRun = true; } else { replies.sort(function(a, b) { var aID, bID; @@ -6442,8 +6436,13 @@ container = containers[_j]; $.rm(container); } - Unread.update(true); + _ref = $$('.threadOP'); + for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) { + post = _ref[_k]; + $.rmClass(post, 'threadOP'); + } } + return Unread.update(true); }, kb: function() { var control; diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index a03406bb9..f977a82a3 100644 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -56,14 +56,13 @@ QuoteThreading = @cb = QuoteThreading.nodeinsert nodeinsert: -> - {posts} = g - qpost = posts[@threaded] + qpost = g.posts[@threaded] delete @threaded delete @cb - return false if @thread.OP is qpost - + return false if @thread.OP is qpost + if QuoteThreading.hasRun height = doc.clientHeight {bottom, top} = qpost.nodes.root.getBoundingClientRect() @@ -88,8 +87,11 @@ QuoteThreading = replies = $$ '.thread > .replyContainer, .threadContainer > .replyContainer', thread QuoteThreading.enabled = @checked if @checked - nodes = (Get.postFromNode reply for reply in replies) - QuoteThreading.node node for node in nodes + QuoteThreading.hasRun = false + for reply in replies + QuoteThreading.node.call node = Get.postFromRoot reply + node.cb() if node.cb + QuoteThreading.hasRun = true else replies.sort (a, b) -> aID = Number a.id[2..] @@ -98,9 +100,9 @@ QuoteThreading = $.add thread, replies containers = $$ '.threadContainer', thread $.rm container for container in containers - Unread.update true - return + $.rmClass post, 'threadOP' for post in $$ '.threadOP' + Unread.update true kb: -> - control = $.id 'threadingControl' - control.click() \ No newline at end of file + control = $.id 'threadingControl' + control.click() \ No newline at end of file