From 1c5c542ca1fb9f9ea726fdb81615c06e2cca8a9a Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Mon, 6 Jan 2014 08:45:17 -0700 Subject: [PATCH] And that should fix everything. Woo. --- LICENSE | 2 +- builds/4chan-X.user.js | 17 ++++++++++------- builds/crx/script.js | 17 ++++++++++------- src/General/lib/randomaccesslist.class | 1 + src/Quotelinks/QuoteThreading.coffee | 13 +++++++------ 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/LICENSE b/LICENSE index f67d12a1d..f27731086 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.2.44 - 2014-01-05 +* 4chan X - Version 1.2.44 - 2014-01-06 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 2e3f25f91..bc7d7c9ff 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -22,7 +22,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.2.44 - 2014-01-05 +* 4chan X - Version 1.2.44 - 2014-01-06 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -1466,6 +1466,9 @@ RandomAccessList.prototype.push = function(item) { var ID, last; ID = item.ID; + if (this[ID]) { + return; + } last = this.last; item.prev = last; this[ID] = item; @@ -5026,7 +5029,7 @@ $.after(root, threadContainer); } else { threadContainer = root.nextSibling; - post = Get.postFromRoot($.x('child::div[contains(@class,"postContainer")][last()]', threadContainer)); + post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer)); } $.add(threadContainer, this.nodes.root); if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) { @@ -5038,12 +5041,12 @@ } if (posts[post.ID]) { posts.after(post, this); + return true; + } + if ((ID = posts.closest(post.ID)) !== -1) { + posts.after(posts[ID], this); } else { - if ((ID = posts.closest(post.ID)) !== -1) { - posts.after(posts[ID], this); - } else { - posts.prepend(this); - } + posts.prepend(this); } return true; }, diff --git a/builds/crx/script.js b/builds/crx/script.js index 8279e6a60..ccd69b978 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.2.44 - 2014-01-05 +* 4chan X - Version 1.2.44 - 2014-01-06 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -1472,6 +1472,9 @@ RandomAccessList.prototype.push = function(item) { var ID, last; ID = item.ID; + if (this[ID]) { + return; + } last = this.last; item.prev = last; this[ID] = item; @@ -5029,7 +5032,7 @@ $.after(root, threadContainer); } else { threadContainer = root.nextSibling; - post = Get.postFromRoot($.x('child::div[contains(@class,"postContainer")][last()]', threadContainer)); + post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer)); } $.add(threadContainer, this.nodes.root); if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) { @@ -5041,12 +5044,12 @@ } if (posts[post.ID]) { posts.after(post, this); + return true; + } + if ((ID = posts.closest(post.ID)) !== -1) { + posts.after(posts[ID], this); } else { - if ((ID = posts.closest(post.ID)) !== -1) { - posts.after(posts[ID], this); - } else { - posts.prepend(this); - } + posts.prepend(this); } return true; }, diff --git a/src/General/lib/randomaccesslist.class b/src/General/lib/randomaccesslist.class index a9955ff62..98c08a670 100644 --- a/src/General/lib/randomaccesslist.class +++ b/src/General/lib/randomaccesslist.class @@ -4,6 +4,7 @@ class RandomAccessList push: (item) -> {ID} = item + return if @[ID] {last} = @ item.prev = last @[ID] = item diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index 6b2c5bbcd..2cac9bbb0 100755 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -72,7 +72,7 @@ QuoteThreading = posts.push @ if Conf['Unread Count'] return false - root = post.nodes.root + {root} = post.nodes unless $.hasClass root, 'threadOP' $.addClass root, 'threadOP' threadContainer = $.el 'div', @@ -80,7 +80,7 @@ QuoteThreading = $.after root, threadContainer else threadContainer = root.nextSibling - post = Get.postFromRoot $.x 'child::div[contains(@class,"postContainer")][last()]', threadContainer + post = Get.postFromRoot $.x 'descendant::div[contains(@class,"postContainer")][last()]', threadContainer $.add threadContainer, @nodes.root @@ -92,11 +92,12 @@ QuoteThreading = if posts[post.ID] posts.after post, @ + return true + + if (ID = posts.closest post.ID) isnt -1 + posts.after posts[ID], @ else - if (ID = posts.closest post.ID) isnt -1 - posts.after posts[ID], @ - else - posts.prepend @ + posts.prepend @ return true