QRPostSuccessful threadID and postID are now integers.
threadID will always give the threadID, not 0 when creating a new thread. Send the board object with it too.
This commit is contained in:
parent
2c42f1afc5
commit
933a861998
@ -4978,7 +4978,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
post: function(e) {
|
post: function(e) {
|
||||||
return Unread.yourPosts.push(+e.detail.postID);
|
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;
|
||||||
@ -5203,7 +5203,7 @@
|
|||||||
return ThreadUpdater.cb.autoUpdate();
|
return ThreadUpdater.cb.autoUpdate();
|
||||||
},
|
},
|
||||||
post: function(e) {
|
post: function(e) {
|
||||||
if (!(Conf['Auto Update This'] && +e.detail.threadID === ThreadUpdater.thread.ID)) {
|
if (!(Conf['Auto Update This'] && e.detail.threadID === ThreadUpdater.thread.ID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ThreadUpdater.outdateCount = 0;
|
ThreadUpdater.outdateCount = 0;
|
||||||
@ -5513,14 +5513,14 @@
|
|||||||
return ThreadWatcher.unwatch(thread[1], thread[3]);
|
return ThreadWatcher.unwatch(thread[1], thread[3]);
|
||||||
},
|
},
|
||||||
post: function(e) {
|
post: function(e) {
|
||||||
var postID, threadID, _ref;
|
var board, postID, threadID, _ref;
|
||||||
_ref = e.detail, postID = _ref.postID, threadID = _ref.threadID;
|
_ref = e.detail, board = _ref.board, postID = _ref.postID, threadID = _ref.threadID;
|
||||||
if (threadID === '0') {
|
if (postID === threadID) {
|
||||||
if (Conf['Auto Watch']) {
|
if (Conf['Auto Watch']) {
|
||||||
return $.set('AutoWatch', +postID);
|
return $.set('AutoWatch', threadID);
|
||||||
}
|
}
|
||||||
} else if (Conf['Auto Watch Reply']) {
|
} else if (Conf['Auto Watch Reply']) {
|
||||||
return ThreadWatcher.watch(g.BOARD.threads[threadID]);
|
return ThreadWatcher.watch(board.threads[threadID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6473,16 +6473,19 @@
|
|||||||
};
|
};
|
||||||
$.set('QR.persona', persona);
|
$.set('QR.persona', persona);
|
||||||
_ref1 = h1.nextSibling.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2];
|
_ref1 = h1.nextSibling.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2];
|
||||||
|
threadID = +threadID;
|
||||||
|
postID = +postID;
|
||||||
$.event('QRPostSuccessful', {
|
$.event('QRPostSuccessful', {
|
||||||
threadID: threadID,
|
board: g.BOARD,
|
||||||
|
threadID: threadID || postID,
|
||||||
postID: postID
|
postID: postID
|
||||||
}, QR.el);
|
}, QR.el);
|
||||||
QR.cooldown.set({
|
QR.cooldown.set({
|
||||||
post: reply,
|
post: reply,
|
||||||
isReply: threadID !== '0'
|
isReply: !!threadID
|
||||||
});
|
});
|
||||||
QR.cooldown.auto = QR.replies.length > 1;
|
QR.cooldown.auto = QR.replies.length > 1;
|
||||||
if (threadID === '0') {
|
if (!threadID) {
|
||||||
$.open("//boards.4chan.org/" + g.BOARD + "/res/" + postID);
|
$.open("//boards.4chan.org/" + g.BOARD + "/res/" + postID);
|
||||||
} else if (g.VIEW === 'reply' && !QR.cooldown.auto) {
|
} else if (g.VIEW === 'reply' && !QR.cooldown.auto) {
|
||||||
$.open("//boards.4chan.org/" + g.BOARD + "/res/" + threadID + "#p" + postID);
|
$.open("//boards.4chan.org/" + g.BOARD + "/res/" + threadID + "#p" + postID);
|
||||||
|
|||||||
@ -3312,7 +3312,7 @@ Unread =
|
|||||||
Unread.addPosts e.detail.newPosts
|
Unread.addPosts e.detail.newPosts
|
||||||
|
|
||||||
post: (e) ->
|
post: (e) ->
|
||||||
Unread.yourPosts.push +e.detail.postID
|
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
|
||||||
@ -3511,7 +3511,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.set 'status', 'Offline', 'warning'
|
ThreadUpdater.set 'status', 'Offline', 'warning'
|
||||||
ThreadUpdater.cb.autoUpdate()
|
ThreadUpdater.cb.autoUpdate()
|
||||||
post: (e) ->
|
post: (e) ->
|
||||||
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
|
||||||
visibility: ->
|
visibility: ->
|
||||||
@ -3770,12 +3770,12 @@ ThreadWatcher =
|
|||||||
thread = @nextElementSibling.pathname.split '/'
|
thread = @nextElementSibling.pathname.split '/'
|
||||||
ThreadWatcher.unwatch thread[1], thread[3]
|
ThreadWatcher.unwatch thread[1], thread[3]
|
||||||
post: (e) ->
|
post: (e) ->
|
||||||
{postID, threadID} = e.detail
|
{board, postID, threadID} = e.detail
|
||||||
if threadID is '0'
|
if postID is threadID
|
||||||
if Conf['Auto Watch']
|
if Conf['Auto Watch']
|
||||||
$.set 'AutoWatch', +postID
|
$.set 'AutoWatch', threadID
|
||||||
else if Conf['Auto Watch Reply']
|
else if Conf['Auto Watch Reply']
|
||||||
ThreadWatcher.watch g.BOARD.threads[threadID]
|
ThreadWatcher.watch board.threads[threadID]
|
||||||
|
|
||||||
toggle: (thread) ->
|
toggle: (thread) ->
|
||||||
if $('.favicon', thread.OP.nodes.post).src is Favicon.empty
|
if $('.favicon', thread.OP.nodes.post).src is Favicon.empty
|
||||||
|
|||||||
@ -786,21 +786,24 @@ QR =
|
|||||||
$.set 'QR.persona', persona
|
$.set 'QR.persona', persona
|
||||||
|
|
||||||
[_, threadID, postID] = h1.nextSibling.textContent.match /thread:(\d+),no:(\d+)/
|
[_, threadID, postID] = h1.nextSibling.textContent.match /thread:(\d+),no:(\d+)/
|
||||||
|
threadID = +threadID
|
||||||
|
postID = +postID
|
||||||
|
|
||||||
# Post/upload confirmed as successful.
|
# Post/upload confirmed as successful.
|
||||||
$.event 'QRPostSuccessful', {
|
$.event 'QRPostSuccessful', {
|
||||||
threadID
|
board: g.BOARD
|
||||||
|
threadID: threadID or postID
|
||||||
postID
|
postID
|
||||||
}, QR.el
|
}, QR.el
|
||||||
|
|
||||||
QR.cooldown.set
|
QR.cooldown.set
|
||||||
post: reply
|
post: reply
|
||||||
isReply: threadID isnt '0'
|
isReply: !!threadID
|
||||||
|
|
||||||
# Enable auto-posting if we have stuff to post, disable it otherwise.
|
# Enable auto-posting if we have stuff to post, disable it otherwise.
|
||||||
QR.cooldown.auto = QR.replies.length > 1
|
QR.cooldown.auto = QR.replies.length > 1
|
||||||
|
|
||||||
if threadID is '0' # new thread
|
unless threadID # new thread
|
||||||
$.open "//boards.4chan.org/#{g.BOARD}/res/#{postID}"
|
$.open "//boards.4chan.org/#{g.BOARD}/res/#{postID}"
|
||||||
else if g.VIEW is 'reply' and !QR.cooldown.auto # posting from the index
|
else if g.VIEW is 'reply' and !QR.cooldown.auto # posting from the index
|
||||||
$.open "//boards.4chan.org/#{g.BOARD}/res/#{threadID}#p#{postID}"
|
$.open "//boards.4chan.org/#{g.BOARD}/res/#{threadID}#p#{postID}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user