Simpler Unread code concerning your posts.
This commit is contained in:
parent
e3765121b0
commit
e7164099c9
@ -4981,7 +4981,6 @@
|
|||||||
Unread.lastReadPost = $.get("lastReadPosts." + this.board, {
|
Unread.lastReadPost = $.get("lastReadPosts." + this.board, {
|
||||||
threads: {}
|
threads: {}
|
||||||
}).threads[this] || 0;
|
}).threads[this] || 0;
|
||||||
Unread.yourPosts = [];
|
|
||||||
Unread.posts = [];
|
Unread.posts = [];
|
||||||
Unread.title = d.title;
|
Unread.title = d.title;
|
||||||
posts = [];
|
posts = [];
|
||||||
@ -4994,15 +4993,17 @@
|
|||||||
}
|
}
|
||||||
Unread.addPosts(posts);
|
Unread.addPosts(posts);
|
||||||
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
$.on(d, 'ThreadUpdate', Unread.onUpdate);
|
||||||
$.on(d, 'QRPostSuccessful', Unread.post);
|
|
||||||
return $.on(d, 'scroll visibilitychange', Unread.read);
|
return $.on(d, 'scroll visibilitychange', Unread.read);
|
||||||
},
|
},
|
||||||
addPosts: function(newPosts) {
|
addPosts: function(newPosts) {
|
||||||
var ID, post, _i, _len;
|
var ID, post, yourPosts, _i, _len;
|
||||||
|
if (Conf['Quick Reply']) {
|
||||||
|
yourPosts = QR.yourPosts.threads[Unread.thread];
|
||||||
|
}
|
||||||
for (_i = 0, _len = newPosts.length; _i < _len; _i++) {
|
for (_i = 0, _len = newPosts.length; _i < _len; _i++) {
|
||||||
post = newPosts[_i];
|
post = newPosts[_i];
|
||||||
ID = post.ID;
|
ID = post.ID;
|
||||||
if (!(ID <= Unread.lastReadPost || post.isHidden || __indexOf.call(Unread.yourPosts, ID) >= 0)) {
|
if (!(ID <= Unread.lastReadPost || post.isHidden || yourPosts && __indexOf.call(yourPosts, ID) >= 0)) {
|
||||||
Unread.posts.push(post);
|
Unread.posts.push(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5016,9 +5017,6 @@
|
|||||||
return Unread.addPosts(e.detail.newPosts);
|
return Unread.addPosts(e.detail.newPosts);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
post: function(e) {
|
|
||||||
return Unread.yourPosts.push(e.detail.postID);
|
|
||||||
},
|
|
||||||
read: function(e) {
|
read: function(e) {
|
||||||
var bottom, height, i, post, _i, _len, _ref;
|
var bottom, height, i, post, _i, _len, _ref;
|
||||||
if (d.hidden || !Unread.posts.length) {
|
if (d.hidden || !Unread.posts.length) {
|
||||||
|
|||||||
@ -3310,7 +3310,6 @@ Unread =
|
|||||||
node: ->
|
node: ->
|
||||||
Unread.thread = @
|
Unread.thread = @
|
||||||
Unread.lastReadPost = $.get("lastReadPosts.#{@board}", threads: {}).threads[@] or 0
|
Unread.lastReadPost = $.get("lastReadPosts.#{@board}", threads: {}).threads[@] or 0
|
||||||
Unread.yourPosts = []
|
|
||||||
Unread.posts = []
|
Unread.posts = []
|
||||||
Unread.title = d.title
|
Unread.title = d.title
|
||||||
posts = []
|
posts = []
|
||||||
@ -3318,13 +3317,14 @@ Unread =
|
|||||||
posts.push post if post.isReply
|
posts.push post if post.isReply
|
||||||
Unread.addPosts posts
|
Unread.addPosts posts
|
||||||
$.on d, 'ThreadUpdate', Unread.onUpdate
|
$.on d, 'ThreadUpdate', Unread.onUpdate
|
||||||
$.on d, 'QRPostSuccessful', Unread.post
|
|
||||||
$.on d, 'scroll visibilitychange', Unread.read
|
$.on d, 'scroll visibilitychange', Unread.read
|
||||||
|
|
||||||
addPosts: (newPosts) ->
|
addPosts: (newPosts) ->
|
||||||
|
if Conf['Quick Reply']
|
||||||
|
yourPosts = QR.yourPosts.threads[Unread.thread]
|
||||||
for post in newPosts
|
for post in newPosts
|
||||||
{ID} = post
|
{ID} = post
|
||||||
unless ID <= Unread.lastReadPost or post.isHidden or ID in Unread.yourPosts
|
unless ID <= Unread.lastReadPost or post.isHidden or yourPosts and ID in yourPosts
|
||||||
Unread.posts.push post
|
Unread.posts.push post
|
||||||
Unread.read()
|
Unread.read()
|
||||||
Unread.update()
|
Unread.update()
|
||||||
@ -3335,9 +3335,6 @@ Unread =
|
|||||||
else
|
else
|
||||||
Unread.addPosts e.detail.newPosts
|
Unread.addPosts e.detail.newPosts
|
||||||
|
|
||||||
post: (e) ->
|
|
||||||
Unread.yourPosts.push e.detail.postID
|
|
||||||
|
|
||||||
read: (e) ->
|
read: (e) ->
|
||||||
return if d.hidden or !Unread.posts.length
|
return if d.hidden or !Unread.posts.length
|
||||||
height = doc.clientHeight
|
height = doc.clientHeight
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user