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;
},
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() {

View File

@ -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() {

View File

@ -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: ->