Added functionality to update thread until (your) post is found.
This commit is contained in:
parent
6fa291468d
commit
1f9546cc03
@ -5575,6 +5575,7 @@
|
|||||||
this.dialog = UI.dialog('updater', 'bottom: 0; right: 0;', html);
|
this.dialog = UI.dialog('updater', 'bottom: 0; right: 0;', html);
|
||||||
this.timer = $('#update-timer', this.dialog);
|
this.timer = $('#update-timer', this.dialog);
|
||||||
this.status = $('#update-status', this.dialog);
|
this.status = $('#update-status', this.dialog);
|
||||||
|
this.checkPostCount = 0;
|
||||||
return Thread.prototype.callbacks.push({
|
return Thread.prototype.callbacks.push({
|
||||||
name: 'Thread Updater',
|
name: 'Thread Updater',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
@ -5646,6 +5647,14 @@
|
|||||||
return setTimeout(ThreadUpdater.update, 1000);
|
return setTimeout(ThreadUpdater.update, 1000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkpost: function() {
|
||||||
|
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 10)) {
|
||||||
|
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * 500);
|
||||||
|
}
|
||||||
|
ThreadUpdater.checkPostCount = 0;
|
||||||
|
delete ThreadUpdater.foundPost;
|
||||||
|
return delete ThreadUpdater.postID;
|
||||||
|
},
|
||||||
visibility: function() {
|
visibility: function() {
|
||||||
if (d.hidden) {
|
if (d.hidden) {
|
||||||
return;
|
return;
|
||||||
@ -5676,7 +5685,7 @@
|
|||||||
return $.cb.value.call(this);
|
return $.cb.value.call(this);
|
||||||
},
|
},
|
||||||
load: function() {
|
load: function() {
|
||||||
var klass, req, text, _ref, _ref1;
|
var klass, req, text, _ref;
|
||||||
req = ThreadUpdater.req;
|
req = ThreadUpdater.req;
|
||||||
switch (req.status) {
|
switch (req.status) {
|
||||||
case 200:
|
case 200:
|
||||||
@ -5705,9 +5714,12 @@
|
|||||||
This saves bandwidth for both the user and the servers and avoid unnecessary computation.
|
This saves bandwidth for both the user and the servers and avoid unnecessary computation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_ref1 = (_ref = req.status) === 0 || _ref === 304 ? [null, null] : ["" + req.statusText + " (" + req.status + ")", 'warning'], text = _ref1[0], klass = _ref1[1];
|
_ref = [0, 304].contains(req.status) ? [null, null] : ["" + req.statusText + " (" + req.status + ")", 'warning'], text = _ref[0], klass = _ref[1];
|
||||||
ThreadUpdater.set('status', text, klass);
|
ThreadUpdater.set('status', text, klass);
|
||||||
}
|
}
|
||||||
|
if (ThreadUpdater.postID) {
|
||||||
|
ThreadUpdater.cb.checkpost(this.status);
|
||||||
|
}
|
||||||
return delete ThreadUpdater.req;
|
return delete ThreadUpdater.req;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -5831,6 +5843,11 @@
|
|||||||
post.kill(true);
|
post.kill(true);
|
||||||
deletedFiles.push(post);
|
deletedFiles.push(post);
|
||||||
}
|
}
|
||||||
|
if (ThreadUpdater.postID) {
|
||||||
|
if (ID === ThreadUpdater.postID) {
|
||||||
|
ThreadUpdater.foundPost = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!count) {
|
if (!count) {
|
||||||
ThreadUpdater.set('status', null, null);
|
ThreadUpdater.set('status', null, null);
|
||||||
@ -7391,6 +7408,7 @@
|
|||||||
threadID = +threadID || postID;
|
threadID = +threadID || postID;
|
||||||
((_base = QR.yourPosts.threads)[threadID] || (_base[threadID] = [])).push(postID);
|
((_base = QR.yourPosts.threads)[threadID] || (_base[threadID] = [])).push(postID);
|
||||||
$.set("yourPosts." + g.BOARD, QR.yourPosts);
|
$.set("yourPosts." + g.BOARD, QR.yourPosts);
|
||||||
|
ThreadUpdater.postID = postID;
|
||||||
$.event('QRPostSuccessful', {
|
$.event('QRPostSuccessful', {
|
||||||
board: g.BOARD,
|
board: g.BOARD,
|
||||||
threadID: threadID,
|
threadID: threadID,
|
||||||
|
|||||||
@ -3737,6 +3737,7 @@ ThreadUpdater =
|
|||||||
@dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html
|
@dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html
|
||||||
@timer = $ '#update-timer', @dialog
|
@timer = $ '#update-timer', @dialog
|
||||||
@status = $ '#update-status', @dialog
|
@status = $ '#update-status', @dialog
|
||||||
|
@checkPostCount = 0
|
||||||
|
|
||||||
Thread::callbacks.push
|
Thread::callbacks.push
|
||||||
name: 'Thread Updater'
|
name: 'Thread Updater'
|
||||||
@ -3793,6 +3794,12 @@ ThreadUpdater =
|
|||||||
return unless Conf['Auto Update This'] and e.detail.threadID is ThreadUpdater.thread.ID
|
return unless Conf['Auto Update This'] and e.detail.threadID is ThreadUpdater.thread.ID
|
||||||
ThreadUpdater.outdateCount = 0
|
ThreadUpdater.outdateCount = 0
|
||||||
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
||||||
|
checkpost: ->
|
||||||
|
unless g.DEAD or ThreadUpdater.foundPost or ThreadUpdater.checkPostCount >= 10
|
||||||
|
return setTimeout ThreadUpdater.update, ++ThreadUpdater.checkPostCount * 500
|
||||||
|
ThreadUpdater.checkPostCount = 0
|
||||||
|
delete ThreadUpdater.foundPost
|
||||||
|
delete ThreadUpdater.postID
|
||||||
visibility: ->
|
visibility: ->
|
||||||
return if d.hidden
|
return if d.hidden
|
||||||
# Reset the counter when we focus this tab.
|
# Reset the counter when we focus this tab.
|
||||||
@ -3839,11 +3846,15 @@ ThreadUpdater =
|
|||||||
This saves bandwidth for both the user and the servers and avoid unnecessary computation.
|
This saves bandwidth for both the user and the servers and avoid unnecessary computation.
|
||||||
###
|
###
|
||||||
# XXX 304 -> 0 in Opera
|
# XXX 304 -> 0 in Opera
|
||||||
[text, klass] = if req.status in [0, 304]
|
[text, klass] = if [0, 304].contains req.status
|
||||||
[null, null]
|
[null, null]
|
||||||
else
|
else
|
||||||
["#{req.statusText} (#{req.status})", 'warning']
|
["#{req.statusText} (#{req.status})", 'warning']
|
||||||
ThreadUpdater.set 'status', text, klass
|
ThreadUpdater.set 'status', text, klass
|
||||||
|
|
||||||
|
if ThreadUpdater.postID
|
||||||
|
ThreadUpdater.cb.checkpost @status
|
||||||
|
|
||||||
delete ThreadUpdater.req
|
delete ThreadUpdater.req
|
||||||
|
|
||||||
getInterval: ->
|
getInterval: ->
|
||||||
@ -3956,6 +3967,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
|
||||||
|
ThreadUpdater.foundPost = true
|
||||||
|
|
||||||
unless count
|
unless count
|
||||||
ThreadUpdater.set 'status', null, null
|
ThreadUpdater.set 'status', null, null
|
||||||
|
|||||||
@ -968,6 +968,8 @@ QR =
|
|||||||
|
|
||||||
(QR.yourPosts.threads[threadID] or= []).push postID
|
(QR.yourPosts.threads[threadID] or= []).push postID
|
||||||
$.set "yourPosts.#{g.BOARD}", QR.yourPosts
|
$.set "yourPosts.#{g.BOARD}", QR.yourPosts
|
||||||
|
|
||||||
|
ThreadUpdater.postID = postID
|
||||||
|
|
||||||
# Post/upload confirmed as successful.
|
# Post/upload confirmed as successful.
|
||||||
$.event 'QRPostSuccessful', {
|
$.event 'QRPostSuccessful', {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user