Consolidate and cleanup

This commit is contained in:
Zixaphir 2014-01-06 08:55:26 -07:00
parent 1c5c542ca1
commit b9f2702daf
3 changed files with 15 additions and 51 deletions

View File

@ -4967,18 +4967,15 @@
if (this.isClone || !QuoteThreading.enabled) {
return;
}
if (Conf['Unread Count']) {
Unread.posts.push(this);
}
if (this.thread.OP === this) {
if (Conf['Unread Count']) {
Unread.posts.push(this);
}
return;
}
quotes = this.quotes, ID = this.ID, fullID = this.fullID;
posts = g.posts;
if (!(post = posts[fullID]) || post.isHidden) {
if (Conf['Unread Count']) {
Unread.posts.push(this);
}
return;
}
keys = [];
@ -5005,18 +5002,12 @@
post = g.posts[this.threaded];
posts = Unread.posts;
if (this.thread.OP === post) {
if (Conf['Unread Count']) {
posts.push(this);
}
return false;
}
if (QuoteThreading.hasRun) {
height = doc.clientHeight;
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) {
if (Conf['Unread Count']) {
posts.push(this);
}
return false;
}
}
@ -5032,13 +5023,9 @@
post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer));
}
$.add(threadContainer, this.nodes.root);
if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) {
this.prev = true;
if (!Conf['Unread Count']) {
return true;
}
if (!posts[this.ID]) {
posts.push(this);
}
if (posts[post.ID]) {
posts.after(post, this);
return true;

View File

@ -4970,18 +4970,15 @@
if (this.isClone || !QuoteThreading.enabled) {
return;
}
if (Conf['Unread Count']) {
Unread.posts.push(this);
}
if (this.thread.OP === this) {
if (Conf['Unread Count']) {
Unread.posts.push(this);
}
return;
}
quotes = this.quotes, ID = this.ID, fullID = this.fullID;
posts = g.posts;
if (!(post = posts[fullID]) || post.isHidden) {
if (Conf['Unread Count']) {
Unread.posts.push(this);
}
return;
}
keys = [];
@ -5008,18 +5005,12 @@
post = g.posts[this.threaded];
posts = Unread.posts;
if (this.thread.OP === post) {
if (Conf['Unread Count']) {
posts.push(this);
}
return false;
}
if (QuoteThreading.hasRun) {
height = doc.clientHeight;
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) {
if (Conf['Unread Count']) {
posts.push(this);
}
return false;
}
}
@ -5035,13 +5026,9 @@
post = Get.postFromRoot($.x('descendant::div[contains(@class,"postContainer")][last()]', threadContainer));
}
$.add(threadContainer, this.nodes.root);
if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) {
this.prev = true;
if (!Conf['Unread Count']) {
return true;
}
if (!posts[this.ID]) {
posts.push(this);
}
if (posts[post.ID]) {
posts.after(post, this);
return true;

View File

@ -33,15 +33,13 @@ QuoteThreading =
node: ->
return if @isClone or not QuoteThreading.enabled
if @thread.OP is @
Unread.posts.push @ if Conf['Unread Count']
return
Unread.posts.push @ if Conf['Unread Count']
return if @thread.OP is @
{quotes, ID, fullID} = @
{posts} = g
if !(post = posts[fullID]) or post.isHidden # Filtered
Unread.posts.push @ if Conf['Unread Count']
return
return if !(post = posts[fullID]) or post.isHidden # Filtered
keys = []
len = "#{g.BOARD}".length + 1
@ -59,18 +57,14 @@ QuoteThreading =
post = g.posts[@threaded]
{posts} = Unread
if @thread.OP is post
posts.push @ if Conf['Unread Count']
return false
return false if @thread.OP is post
if QuoteThreading.hasRun
height = doc.clientHeight
{bottom, top} = post.nodes.root.getBoundingClientRect()
# Post is unread or is fully visible.
unless posts?[post.ID] or ((bottom < height) and (top > 0))
posts.push @ if Conf['Unread Count']
return false
return false unless posts?[post.ID] or ((bottom < height) and (top > 0))
{root} = post.nodes
unless $.hasClass root, 'threadOP'
@ -84,11 +78,7 @@ QuoteThreading =
$.add threadContainer, @nodes.root
if not Conf['Unread Count'] or @ID < Unread.lastReadPost
@prev = true # Force Unread Count to ignore this post
return true
posts.push @ unless posts[@ID]
return true unless Conf['Unread Count']
if posts[post.ID]
posts.after post, @