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

View File

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

View File

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