Fix ThreadUpdater timing out due to nodes not existing.
This commit is contained in:
parent
49585245ea
commit
057c7af8cc
@ -6848,7 +6848,7 @@
|
|||||||
value: Conf['Interval']
|
value: Conf['Interval']
|
||||||
}));
|
}));
|
||||||
$.on(window, 'online offline', ThreadUpdater.cb.online);
|
$.on(window, 'online offline', ThreadUpdater.cb.online);
|
||||||
$.on(d, 'QRPostSuccessful', ThreadUpdater.cb.post);
|
$.on(d, 'QRPostSuccessful', ThreadUpdater.cb.checkpost);
|
||||||
$.on(d, 'visibilitychange', ThreadUpdater.cb.visibility);
|
$.on(d, 'visibilitychange', ThreadUpdater.cb.visibility);
|
||||||
return ThreadUpdater.cb.online();
|
return ThreadUpdater.cb.online();
|
||||||
},
|
},
|
||||||
@ -6881,8 +6881,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkpost: function() {
|
checkpost: function() {
|
||||||
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 10)) {
|
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 5)) {
|
||||||
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * 500);
|
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND);
|
||||||
}
|
}
|
||||||
ThreadUpdater.checkPostCount = 0;
|
ThreadUpdater.checkPostCount = 0;
|
||||||
delete ThreadUpdater.foundPost;
|
delete ThreadUpdater.foundPost;
|
||||||
@ -6960,7 +6960,7 @@
|
|||||||
ThreadUpdater.set('status', text, klass);
|
ThreadUpdater.set('status', text, klass);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID) {
|
if (ThreadUpdater.postID) {
|
||||||
ThreadUpdater.cb.checkpost(this.status);
|
ThreadUpdater.cb.checkpost();
|
||||||
}
|
}
|
||||||
return delete ThreadUpdater.req;
|
return delete ThreadUpdater.req;
|
||||||
}
|
}
|
||||||
@ -7061,7 +7061,7 @@
|
|||||||
return $.after(root, [$.tn(' '), icon]);
|
return $.after(root, [$.tn(' '), icon]);
|
||||||
},
|
},
|
||||||
parse: function(postObjects) {
|
parse: function(postObjects) {
|
||||||
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, scroll, _i, _len, _ref;
|
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, root, scroll, _i, _len, _ref;
|
||||||
|
|
||||||
OP = postObjects[0];
|
OP = postObjects[0];
|
||||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
||||||
@ -7102,10 +7102,8 @@
|
|||||||
post.kill(true);
|
post.kill(true);
|
||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID) {
|
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
||||||
if (ID === ThreadUpdater.postID) {
|
ThreadUpdater.foundPost = true;
|
||||||
ThreadUpdater.foundPost = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!count) {
|
if (!count) {
|
||||||
@ -7130,19 +7128,22 @@
|
|||||||
if (!posts.hasOwnProperty(key)) {
|
if (!posts.hasOwnProperty(key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
root = post.nodes.root;
|
||||||
if (post.cb) {
|
if (post.cb) {
|
||||||
if (!post.cb.call(post)) {
|
if (!post.cb.call(post)) {
|
||||||
$.add(ThreadUpdater.root, post.nodes.root);
|
$.add(ThreadUpdater.root, root);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$.add(ThreadUpdater.root, post.nodes.root);
|
$.add(ThreadUpdater.root, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
if (Conf['Bottom Scroll']) {
|
if (Conf['Bottom Scroll']) {
|
||||||
doc.scrollTop = d.body.clientHeight;
|
doc.scrollTop = d.body.clientHeight;
|
||||||
} else {
|
} else {
|
||||||
Header.scrollToPost(nodes[0]);
|
if (root) {
|
||||||
|
Header.scrollToPost(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.queueTask(function() {
|
$.queueTask(function() {
|
||||||
|
|||||||
@ -6869,7 +6869,7 @@
|
|||||||
value: Conf['Interval']
|
value: Conf['Interval']
|
||||||
}));
|
}));
|
||||||
$.on(window, 'online offline', ThreadUpdater.cb.online);
|
$.on(window, 'online offline', ThreadUpdater.cb.online);
|
||||||
$.on(d, 'QRPostSuccessful', ThreadUpdater.cb.post);
|
$.on(d, 'QRPostSuccessful', ThreadUpdater.cb.checkpost);
|
||||||
$.on(d, 'visibilitychange', ThreadUpdater.cb.visibility);
|
$.on(d, 'visibilitychange', ThreadUpdater.cb.visibility);
|
||||||
return ThreadUpdater.cb.online();
|
return ThreadUpdater.cb.online();
|
||||||
},
|
},
|
||||||
@ -6902,8 +6902,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkpost: function() {
|
checkpost: function() {
|
||||||
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 10)) {
|
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 5)) {
|
||||||
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * 500);
|
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND);
|
||||||
}
|
}
|
||||||
ThreadUpdater.checkPostCount = 0;
|
ThreadUpdater.checkPostCount = 0;
|
||||||
delete ThreadUpdater.foundPost;
|
delete ThreadUpdater.foundPost;
|
||||||
@ -6981,7 +6981,7 @@
|
|||||||
ThreadUpdater.set('status', text, klass);
|
ThreadUpdater.set('status', text, klass);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID) {
|
if (ThreadUpdater.postID) {
|
||||||
ThreadUpdater.cb.checkpost(this.status);
|
ThreadUpdater.cb.checkpost();
|
||||||
}
|
}
|
||||||
return delete ThreadUpdater.req;
|
return delete ThreadUpdater.req;
|
||||||
}
|
}
|
||||||
@ -7082,7 +7082,7 @@
|
|||||||
return $.after(root, [$.tn(' '), icon]);
|
return $.after(root, [$.tn(' '), icon]);
|
||||||
},
|
},
|
||||||
parse: function(postObjects) {
|
parse: function(postObjects) {
|
||||||
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, scroll, _i, _len, _ref;
|
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, root, scroll, _i, _len, _ref;
|
||||||
|
|
||||||
OP = postObjects[0];
|
OP = postObjects[0];
|
||||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
||||||
@ -7123,10 +7123,8 @@
|
|||||||
post.kill(true);
|
post.kill(true);
|
||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID) {
|
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
||||||
if (ID === ThreadUpdater.postID) {
|
ThreadUpdater.foundPost = true;
|
||||||
ThreadUpdater.foundPost = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!count) {
|
if (!count) {
|
||||||
@ -7151,19 +7149,22 @@
|
|||||||
if (!posts.hasOwnProperty(key)) {
|
if (!posts.hasOwnProperty(key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
root = post.nodes.root;
|
||||||
if (post.cb) {
|
if (post.cb) {
|
||||||
if (!post.cb.call(post)) {
|
if (!post.cb.call(post)) {
|
||||||
$.add(ThreadUpdater.root, post.nodes.root);
|
$.add(ThreadUpdater.root, root);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$.add(ThreadUpdater.root, post.nodes.root);
|
$.add(ThreadUpdater.root, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
if (Conf['Bottom Scroll']) {
|
if (Conf['Bottom Scroll']) {
|
||||||
doc.scrollTop = d.body.clientHeight;
|
doc.scrollTop = d.body.clientHeight;
|
||||||
} else {
|
} else {
|
||||||
Header.scrollToPost(nodes[0]);
|
if (root) {
|
||||||
|
Header.scrollToPost(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.queueTask(function() {
|
$.queueTask(function() {
|
||||||
|
|||||||
@ -6847,7 +6847,7 @@
|
|||||||
value: Conf['Interval']
|
value: Conf['Interval']
|
||||||
}));
|
}));
|
||||||
$.on(window, 'online offline', ThreadUpdater.cb.online);
|
$.on(window, 'online offline', ThreadUpdater.cb.online);
|
||||||
$.on(d, 'QRPostSuccessful', ThreadUpdater.cb.post);
|
$.on(d, 'QRPostSuccessful', ThreadUpdater.cb.checkpost);
|
||||||
$.on(d, 'visibilitychange', ThreadUpdater.cb.visibility);
|
$.on(d, 'visibilitychange', ThreadUpdater.cb.visibility);
|
||||||
return ThreadUpdater.cb.online();
|
return ThreadUpdater.cb.online();
|
||||||
},
|
},
|
||||||
@ -6880,8 +6880,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkpost: function() {
|
checkpost: function() {
|
||||||
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 10)) {
|
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 5)) {
|
||||||
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * 500);
|
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND);
|
||||||
}
|
}
|
||||||
ThreadUpdater.checkPostCount = 0;
|
ThreadUpdater.checkPostCount = 0;
|
||||||
delete ThreadUpdater.foundPost;
|
delete ThreadUpdater.foundPost;
|
||||||
@ -6959,7 +6959,7 @@
|
|||||||
ThreadUpdater.set('status', text, klass);
|
ThreadUpdater.set('status', text, klass);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID) {
|
if (ThreadUpdater.postID) {
|
||||||
ThreadUpdater.cb.checkpost(this.status);
|
ThreadUpdater.cb.checkpost();
|
||||||
}
|
}
|
||||||
return delete ThreadUpdater.req;
|
return delete ThreadUpdater.req;
|
||||||
}
|
}
|
||||||
@ -7060,7 +7060,7 @@
|
|||||||
return $.after(root, [$.tn(' '), icon]);
|
return $.after(root, [$.tn(' '), icon]);
|
||||||
},
|
},
|
||||||
parse: function(postObjects) {
|
parse: function(postObjects) {
|
||||||
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, scroll, _i, _len, _ref;
|
var ID, OP, count, deletedFiles, deletedPosts, files, index, key, node, num, post, postObject, posts, root, scroll, _i, _len, _ref;
|
||||||
|
|
||||||
OP = postObjects[0];
|
OP = postObjects[0];
|
||||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler;
|
||||||
@ -7101,10 +7101,8 @@
|
|||||||
post.kill(true);
|
post.kill(true);
|
||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
if (ThreadUpdater.postID) {
|
if (ThreadUpdater.postID && ThreadUpdater.postID === ID) {
|
||||||
if (ID === ThreadUpdater.postID) {
|
ThreadUpdater.foundPost = true;
|
||||||
ThreadUpdater.foundPost = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!count) {
|
if (!count) {
|
||||||
@ -7129,19 +7127,22 @@
|
|||||||
if (!posts.hasOwnProperty(key)) {
|
if (!posts.hasOwnProperty(key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
root = post.nodes.root;
|
||||||
if (post.cb) {
|
if (post.cb) {
|
||||||
if (!post.cb.call(post)) {
|
if (!post.cb.call(post)) {
|
||||||
$.add(ThreadUpdater.root, post.nodes.root);
|
$.add(ThreadUpdater.root, root);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$.add(ThreadUpdater.root, post.nodes.root);
|
$.add(ThreadUpdater.root, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
if (Conf['Bottom Scroll']) {
|
if (Conf['Bottom Scroll']) {
|
||||||
d.body.scrollTop = d.body.clientHeight;
|
d.body.scrollTop = d.body.clientHeight;
|
||||||
} else {
|
} else {
|
||||||
Header.scrollToPost(nodes[0]);
|
if (root) {
|
||||||
|
Header.scrollToPost(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.queueTask(function() {
|
$.queueTask(function() {
|
||||||
|
|||||||
@ -68,7 +68,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.cb.interval.call $.el 'input', value: Conf['Interval']
|
ThreadUpdater.cb.interval.call $.el 'input', value: Conf['Interval']
|
||||||
|
|
||||||
$.on window, 'online offline', ThreadUpdater.cb.online
|
$.on window, 'online offline', ThreadUpdater.cb.online
|
||||||
$.on d, 'QRPostSuccessful', ThreadUpdater.cb.post
|
$.on d, 'QRPostSuccessful', ThreadUpdater.cb.checkpost
|
||||||
$.on d, 'visibilitychange', ThreadUpdater.cb.visibility
|
$.on d, 'visibilitychange', ThreadUpdater.cb.visibility
|
||||||
|
|
||||||
ThreadUpdater.cb.online()
|
ThreadUpdater.cb.online()
|
||||||
@ -84,7 +84,7 @@ ThreadUpdater =
|
|||||||
if ThreadUpdater.online = navigator.onLine
|
if ThreadUpdater.online = navigator.onLine
|
||||||
ThreadUpdater.outdateCount = 0
|
ThreadUpdater.outdateCount = 0
|
||||||
ThreadUpdater.set 'timer', ThreadUpdater.getInterval()
|
ThreadUpdater.set 'timer', ThreadUpdater.getInterval()
|
||||||
|
|
||||||
ThreadUpdater.update()
|
ThreadUpdater.update()
|
||||||
|
|
||||||
ThreadUpdater.set 'status', null, null
|
ThreadUpdater.set 'status', null, null
|
||||||
@ -97,8 +97,8 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.outdateCount = 0
|
ThreadUpdater.outdateCount = 0
|
||||||
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
||||||
checkpost: ->
|
checkpost: ->
|
||||||
unless g.DEAD or ThreadUpdater.foundPost or ThreadUpdater.checkPostCount >= 10
|
unless g.DEAD or ThreadUpdater.foundPost or ThreadUpdater.checkPostCount >= 5
|
||||||
return setTimeout ThreadUpdater.update, ++ThreadUpdater.checkPostCount * 500
|
return setTimeout ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND
|
||||||
ThreadUpdater.checkPostCount = 0
|
ThreadUpdater.checkPostCount = 0
|
||||||
delete ThreadUpdater.foundPost
|
delete ThreadUpdater.foundPost
|
||||||
delete ThreadUpdater.postID
|
delete ThreadUpdater.postID
|
||||||
@ -158,7 +158,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.set 'status', text, klass
|
ThreadUpdater.set 'status', text, klass
|
||||||
|
|
||||||
if ThreadUpdater.postID
|
if ThreadUpdater.postID
|
||||||
ThreadUpdater.cb.checkpost @status
|
ThreadUpdater.cb.checkpost()
|
||||||
|
|
||||||
delete ThreadUpdater.req
|
delete ThreadUpdater.req
|
||||||
|
|
||||||
@ -280,9 +280,9 @@ ThreadUpdater =
|
|||||||
else if post.file and !post.file.isDead and not files.contains ID
|
else if post.file and !post.file.isDead and not files.contains ID
|
||||||
post.kill true
|
post.kill true
|
||||||
deletedFiles.push post
|
deletedFiles.push post
|
||||||
if ThreadUpdater.postID
|
|
||||||
if ID is ThreadUpdater.postID
|
if ThreadUpdater.postID and ThreadUpdater.postID is ID
|
||||||
ThreadUpdater.foundPost = true
|
ThreadUpdater.foundPost = true
|
||||||
|
|
||||||
unless count
|
unless count
|
||||||
ThreadUpdater.set 'status', null, null
|
ThreadUpdater.set 'status', null, null
|
||||||
@ -304,17 +304,18 @@ ThreadUpdater =
|
|||||||
|
|
||||||
for key, post of posts
|
for key, post of posts
|
||||||
continue unless posts.hasOwnProperty key
|
continue unless posts.hasOwnProperty key
|
||||||
|
root = post.nodes.root
|
||||||
if post.cb
|
if post.cb
|
||||||
unless post.cb.call post
|
unless post.cb.call post
|
||||||
$.add ThreadUpdater.root, post.nodes.root
|
$.add ThreadUpdater.root, root
|
||||||
else
|
else
|
||||||
$.add ThreadUpdater.root, post.nodes.root
|
$.add ThreadUpdater.root, root
|
||||||
|
|
||||||
if scroll
|
if scroll
|
||||||
if Conf['Bottom Scroll']
|
if Conf['Bottom Scroll']
|
||||||
<% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop = d.body.clientHeight
|
<% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop = d.body.clientHeight
|
||||||
else
|
else
|
||||||
Header.scrollToPost nodes[0]
|
Header.scrollToPost root if root
|
||||||
|
|
||||||
$.queueTask ->
|
$.queueTask ->
|
||||||
# Enable 4chan features.
|
# Enable 4chan features.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user