And... I think that's done. Well, that wasn't hard.

This commit is contained in:
Zixaphir 2014-01-05 10:52:58 -07:00
parent d31b18cc82
commit c1427e4494
3 changed files with 35 additions and 30 deletions

View File

@ -4977,31 +4977,32 @@
return this.cb = QuoteThreading.nodeinsert; return this.cb = QuoteThreading.nodeinsert;
}, },
nodeinsert: function() { nodeinsert: function() {
var bottom, height, qpost, qroot, threadContainer, top, _ref; var bottom, height, post, root, threadContainer, top, _ref;
qpost = g.posts[this.threaded]; post = g.posts[this.threaded];
delete this.threaded; delete this.threaded;
delete this.cb; delete this.cb;
if (this.thread.OP === qpost) { if (this.thread.OP === post) {
return false; return false;
} }
if (QuoteThreading.hasRun) { if (QuoteThreading.hasRun) {
height = doc.clientHeight; height = doc.clientHeight;
_ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; _ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
if (!(Unread.posts[qpost.ID] || ((bottom < height) && (top > 0)))) { if (!(Unread.posts[post.ID] || ((bottom < height) && (top > 0)))) {
return false; return false;
} }
} }
qroot = qpost.nodes.root; root = post.nodes.root;
if (!$.hasClass(qroot, 'threadOP')) { if (!$.hasClass(root, 'threadOP')) {
$.addClass(qroot, 'threadOP'); $.addClass(root, 'threadOP');
threadContainer = $.el('div', { threadContainer = $.el('div', {
className: 'threadContainer' className: 'threadContainer'
}); });
$.after(qroot, threadContainer); $.after(root, threadContainer);
} else { } else {
threadContainer = qroot.nextSibling; threadContainer = root.nextSibling;
} }
$.add(threadContainer, this.nodes.root); $.add(threadContainer, this.nodes.root);
Unread.posts.after(post.ID, this);
return true; return true;
}, },
toggle: function() { toggle: function() {

View File

@ -4980,31 +4980,32 @@
return this.cb = QuoteThreading.nodeinsert; return this.cb = QuoteThreading.nodeinsert;
}, },
nodeinsert: function() { nodeinsert: function() {
var bottom, height, qpost, qroot, threadContainer, top, _ref; var bottom, height, post, root, threadContainer, top, _ref;
qpost = g.posts[this.threaded]; post = g.posts[this.threaded];
delete this.threaded; delete this.threaded;
delete this.cb; delete this.cb;
if (this.thread.OP === qpost) { if (this.thread.OP === post) {
return false; return false;
} }
if (QuoteThreading.hasRun) { if (QuoteThreading.hasRun) {
height = doc.clientHeight; height = doc.clientHeight;
_ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; _ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
if (!(Unread.posts[qpost.ID] || ((bottom < height) && (top > 0)))) { if (!(Unread.posts[post.ID] || ((bottom < height) && (top > 0)))) {
return false; return false;
} }
} }
qroot = qpost.nodes.root; root = post.nodes.root;
if (!$.hasClass(qroot, 'threadOP')) { if (!$.hasClass(root, 'threadOP')) {
$.addClass(qroot, 'threadOP'); $.addClass(root, 'threadOP');
threadContainer = $.el('div', { threadContainer = $.el('div', {
className: 'threadContainer' className: 'threadContainer'
}); });
$.after(qroot, threadContainer); $.after(root, threadContainer);
} else { } else {
threadContainer = qroot.nextSibling; threadContainer = root.nextSibling;
} }
$.add(threadContainer, this.nodes.root); $.add(threadContainer, this.nodes.root);
Unread.posts.after(post.ID, this);
return true; return true;
}, },
toggle: function() { toggle: function() {

View File

@ -36,7 +36,7 @@ QuoteThreading =
node: -> node: ->
return if @isClone or not QuoteThreading.enabled or @thread.OP is @ return if @isClone or not QuoteThreading.enabled or @thread.OP is @
{replies} = Unread {replies} = Unread
{quotes, ID, fullID} = @ {quotes, ID, fullID} = @
@ -58,30 +58,33 @@ QuoteThreading =
@cb = QuoteThreading.nodeinsert @cb = QuoteThreading.nodeinsert
nodeinsert: -> nodeinsert: ->
qpost = g.posts[@threaded] post = g.posts[@threaded]
delete @threaded delete @threaded
delete @cb delete @cb
return false if @thread.OP is qpost return false if @thread.OP is post
if QuoteThreading.hasRun if QuoteThreading.hasRun
height = doc.clientHeight height = doc.clientHeight
{bottom, top} = qpost.nodes.root.getBoundingClientRect() {bottom, top} = post.nodes.root.getBoundingClientRect()
# Post is unread or is fully visible. # 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 root = post.nodes.root
unless $.hasClass qroot, 'threadOP' unless $.hasClass root, 'threadOP'
$.addClass qroot, 'threadOP' $.addClass root, 'threadOP'
threadContainer = $.el 'div', threadContainer = $.el 'div',
className: 'threadContainer' className: 'threadContainer'
$.after qroot, threadContainer $.after root, threadContainer
else else
threadContainer = qroot.nextSibling threadContainer = root.nextSibling
$.add threadContainer, @nodes.root $.add threadContainer, @nodes.root
Unread.posts.after post.ID, @
return true return true
toggle: -> toggle: ->