diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 69f9c020e..e688b10c3 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -4977,31 +4977,32 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var bottom, height, qpost, qroot, threadContainer, top, _ref; - qpost = g.posts[this.threaded]; + var bottom, height, post, root, threadContainer, top, _ref; + post = g.posts[this.threaded]; delete this.threaded; delete this.cb; - if (this.thread.OP === qpost) { + if (this.thread.OP === post) { return false; } if (QuoteThreading.hasRun) { height = doc.clientHeight; - _ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; - if (!(Unread.posts[qpost.ID] || ((bottom < height) && (top > 0)))) { + _ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; + if (!(Unread.posts[post.ID] || ((bottom < height) && (top > 0)))) { return false; } } - qroot = qpost.nodes.root; - if (!$.hasClass(qroot, 'threadOP')) { - $.addClass(qroot, 'threadOP'); + root = post.nodes.root; + if (!$.hasClass(root, 'threadOP')) { + $.addClass(root, 'threadOP'); threadContainer = $.el('div', { className: 'threadContainer' }); - $.after(qroot, threadContainer); + $.after(root, threadContainer); } else { - threadContainer = qroot.nextSibling; + threadContainer = root.nextSibling; } $.add(threadContainer, this.nodes.root); + Unread.posts.after(post.ID, this); return true; }, toggle: function() { diff --git a/builds/crx/script.js b/builds/crx/script.js index 2891e2a7a..f2f569043 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4980,31 +4980,32 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var bottom, height, qpost, qroot, threadContainer, top, _ref; - qpost = g.posts[this.threaded]; + var bottom, height, post, root, threadContainer, top, _ref; + post = g.posts[this.threaded]; delete this.threaded; delete this.cb; - if (this.thread.OP === qpost) { + if (this.thread.OP === post) { return false; } if (QuoteThreading.hasRun) { height = doc.clientHeight; - _ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; - if (!(Unread.posts[qpost.ID] || ((bottom < height) && (top > 0)))) { + _ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; + if (!(Unread.posts[post.ID] || ((bottom < height) && (top > 0)))) { return false; } } - qroot = qpost.nodes.root; - if (!$.hasClass(qroot, 'threadOP')) { - $.addClass(qroot, 'threadOP'); + root = post.nodes.root; + if (!$.hasClass(root, 'threadOP')) { + $.addClass(root, 'threadOP'); threadContainer = $.el('div', { className: 'threadContainer' }); - $.after(qroot, threadContainer); + $.after(root, threadContainer); } else { - threadContainer = qroot.nextSibling; + threadContainer = root.nextSibling; } $.add(threadContainer, this.nodes.root); + Unread.posts.after(post.ID, this); return true; }, toggle: function() { diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index 0bc8981f4..5da0476e5 100755 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -36,7 +36,7 @@ QuoteThreading = node: -> return if @isClone or not QuoteThreading.enabled or @thread.OP is @ - + {replies} = Unread {quotes, ID, fullID} = @ @@ -58,30 +58,33 @@ QuoteThreading = @cb = QuoteThreading.nodeinsert nodeinsert: -> - qpost = g.posts[@threaded] + post = g.posts[@threaded] delete @threaded delete @cb - return false if @thread.OP is qpost + return false if @thread.OP is post if QuoteThreading.hasRun height = doc.clientHeight - {bottom, top} = qpost.nodes.root.getBoundingClientRect() + {bottom, top} = post.nodes.root.getBoundingClientRect() # Post is unread or is fully visible. - return false unless Unread.posts[qpost.ID] or ((bottom < height) and (top > 0)) + return false unless Unread.posts[post.ID] or ((bottom < height) and (top > 0)) - qroot = qpost.nodes.root - unless $.hasClass qroot, 'threadOP' - $.addClass qroot, 'threadOP' + root = post.nodes.root + unless $.hasClass root, 'threadOP' + $.addClass root, 'threadOP' threadContainer = $.el 'div', className: 'threadContainer' - $.after qroot, threadContainer + $.after root, threadContainer else - threadContainer = qroot.nextSibling + threadContainer = root.nextSibling $.add threadContainer, @nodes.root + + Unread.posts.after post.ID, @ + return true toggle: ->