Fix thread updater
This commit is contained in:
parent
8135493359
commit
fc90fd45d9
@ -9218,7 +9218,7 @@
|
|||||||
return new Notice('info', "The thread is " + change + ".", 30);
|
return new Notice('info', "The thread is " + change + ".", 30);
|
||||||
},
|
},
|
||||||
parse: function(postObjects) {
|
parse: function(postObjects) {
|
||||||
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, root, scroll, _i, _j, _len, _len1, _ref;
|
var OP, count, deletedFiles, deletedPosts, files, index, node, num, post, postObject, posts, root, scroll, _i, _j, _len, _len1;
|
||||||
OP = postObjects[0];
|
OP = postObjects[0];
|
||||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
||||||
ThreadUpdater.updateThreadStatus('Sticky', !!OP.sticky);
|
ThreadUpdater.updateThreadStatus('Sticky', !!OP.sticky);
|
||||||
@ -9245,12 +9245,9 @@
|
|||||||
}
|
}
|
||||||
deletedPosts = [];
|
deletedPosts = [];
|
||||||
deletedFiles = [];
|
deletedFiles = [];
|
||||||
posts = ThreadUpdater.thread.posts;
|
ThreadUpdater.thread.posts.forEach(function(post) {
|
||||||
_ref = posts.keys;
|
var ID;
|
||||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
ID = +post.ID;
|
||||||
ID = _ref[_j];
|
|
||||||
post = posts[ID];
|
|
||||||
ID = +ID;
|
|
||||||
if (__indexOf.call(index, ID) < 0) {
|
if (__indexOf.call(index, ID) < 0) {
|
||||||
post.kill();
|
post.kill();
|
||||||
deletedPosts.push(post);
|
deletedPosts.push(post);
|
||||||
@ -9261,9 +9258,9 @@
|
|||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
||||||
ThreadUpdater.foundPost = true;
|
return ThreadUpdater.foundPost = true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
if (!count) {
|
if (!count) {
|
||||||
ThreadUpdater.set('status', null, null);
|
ThreadUpdater.set('status', null, null);
|
||||||
ThreadUpdater.outdateCount++;
|
ThreadUpdater.outdateCount++;
|
||||||
@ -9281,11 +9278,8 @@
|
|||||||
ThreadUpdater.lastPost = posts[count - 1].ID;
|
ThreadUpdater.lastPost = posts[count - 1].ID;
|
||||||
Main.callbackNodes(Post, posts);
|
Main.callbackNodes(Post, posts);
|
||||||
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25;
|
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25;
|
||||||
for (key in posts) {
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
post = posts[key];
|
post = posts[_j];
|
||||||
if (!posts.hasOwnProperty(key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
root = post.nodes.root;
|
root = post.nodes.root;
|
||||||
if (post.cb) {
|
if (post.cb) {
|
||||||
if (!post.cb()) {
|
if (!post.cb()) {
|
||||||
|
|||||||
@ -9201,7 +9201,7 @@
|
|||||||
return new Notice('info', "The thread is " + change + ".", 30);
|
return new Notice('info', "The thread is " + change + ".", 30);
|
||||||
},
|
},
|
||||||
parse: function(postObjects) {
|
parse: function(postObjects) {
|
||||||
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, root, scroll, _i, _j, _len, _len1, _ref;
|
var OP, count, deletedFiles, deletedPosts, files, index, node, num, post, postObject, posts, root, scroll, _i, _j, _len, _len1;
|
||||||
OP = postObjects[0];
|
OP = postObjects[0];
|
||||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
||||||
ThreadUpdater.updateThreadStatus('Sticky', !!OP.sticky);
|
ThreadUpdater.updateThreadStatus('Sticky', !!OP.sticky);
|
||||||
@ -9228,12 +9228,9 @@
|
|||||||
}
|
}
|
||||||
deletedPosts = [];
|
deletedPosts = [];
|
||||||
deletedFiles = [];
|
deletedFiles = [];
|
||||||
posts = ThreadUpdater.thread.posts;
|
ThreadUpdater.thread.posts.forEach(function(post) {
|
||||||
_ref = posts.keys;
|
var ID;
|
||||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
ID = +post.ID;
|
||||||
ID = _ref[_j];
|
|
||||||
post = posts[ID];
|
|
||||||
ID = +ID;
|
|
||||||
if (__indexOf.call(index, ID) < 0) {
|
if (__indexOf.call(index, ID) < 0) {
|
||||||
post.kill();
|
post.kill();
|
||||||
deletedPosts.push(post);
|
deletedPosts.push(post);
|
||||||
@ -9244,9 +9241,9 @@
|
|||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
||||||
ThreadUpdater.foundPost = true;
|
return ThreadUpdater.foundPost = true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
if (!count) {
|
if (!count) {
|
||||||
ThreadUpdater.set('status', null, null);
|
ThreadUpdater.set('status', null, null);
|
||||||
ThreadUpdater.outdateCount++;
|
ThreadUpdater.outdateCount++;
|
||||||
@ -9264,11 +9261,8 @@
|
|||||||
ThreadUpdater.lastPost = posts[count - 1].ID;
|
ThreadUpdater.lastPost = posts[count - 1].ID;
|
||||||
Main.callbackNodes(Post, posts);
|
Main.callbackNodes(Post, posts);
|
||||||
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25;
|
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25;
|
||||||
for (key in posts) {
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
post = posts[key];
|
post = posts[_j];
|
||||||
if (!posts.hasOwnProperty(key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
root = post.nodes.root;
|
root = post.nodes.root;
|
||||||
if (post.cb) {
|
if (post.cb) {
|
||||||
if (!post.cb()) {
|
if (!post.cb()) {
|
||||||
|
|||||||
@ -290,13 +290,11 @@ ThreadUpdater =
|
|||||||
deletedFiles = []
|
deletedFiles = []
|
||||||
|
|
||||||
# Check for deleted posts/files.
|
# Check for deleted posts/files.
|
||||||
{posts} = ThreadUpdater.thread
|
ThreadUpdater.thread.posts.forEach (post) ->
|
||||||
for ID in posts.keys
|
|
||||||
post = posts[ID]
|
|
||||||
# XXX tmp fix for 4chan's racing condition
|
# XXX tmp fix for 4chan's racing condition
|
||||||
# giving us false-positive dead posts.
|
# giving us false-positive dead posts.
|
||||||
# continue if post.isDead
|
# continue if post.isDead
|
||||||
ID = +ID
|
ID = +post.ID
|
||||||
|
|
||||||
unless ID in index
|
unless ID in index
|
||||||
post.kill()
|
post.kill()
|
||||||
@ -307,6 +305,7 @@ ThreadUpdater =
|
|||||||
post.kill true
|
post.kill true
|
||||||
deletedFiles.push post
|
deletedFiles.push post
|
||||||
|
|
||||||
|
# Fetching your own posts after posting
|
||||||
if ThreadUpdater.postID and ThreadUpdater.postID is ID
|
if ThreadUpdater.postID and ThreadUpdater.postID is ID
|
||||||
ThreadUpdater.foundPost = true
|
ThreadUpdater.foundPost = true
|
||||||
|
|
||||||
@ -327,8 +326,7 @@ ThreadUpdater =
|
|||||||
scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and
|
scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and
|
||||||
ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25
|
ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25
|
||||||
|
|
||||||
for key, post of posts
|
for post in posts
|
||||||
continue unless posts.hasOwnProperty key
|
|
||||||
root = post.nodes.root
|
root = post.nodes.root
|
||||||
if post.cb
|
if post.cb
|
||||||
unless post.cb()
|
unless post.cb()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user