diff --git a/4chan_x.user.js b/4chan_x.user.js index 9c307ed78..4702d7875 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4978,7 +4978,7 @@ } }, post: function(e) { - return Unread.yourPosts.push(+e.detail.postID); + return Unread.yourPosts.push(e.detail.postID); }, read: function(e) { var bottom, height, i, post, _i, _len, _ref; @@ -5203,7 +5203,7 @@ return ThreadUpdater.cb.autoUpdate(); }, 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; } ThreadUpdater.outdateCount = 0; @@ -5513,14 +5513,14 @@ return ThreadWatcher.unwatch(thread[1], thread[3]); }, post: function(e) { - var postID, threadID, _ref; - _ref = e.detail, postID = _ref.postID, threadID = _ref.threadID; - if (threadID === '0') { + var board, postID, threadID, _ref; + _ref = e.detail, board = _ref.board, postID = _ref.postID, threadID = _ref.threadID; + if (postID === threadID) { if (Conf['Auto Watch']) { - return $.set('AutoWatch', +postID); + return $.set('AutoWatch', threadID); } } 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); _ref1 = h1.nextSibling.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2]; + threadID = +threadID; + postID = +postID; $.event('QRPostSuccessful', { - threadID: threadID, + board: g.BOARD, + threadID: threadID || postID, postID: postID }, QR.el); QR.cooldown.set({ post: reply, - isReply: threadID !== '0' + isReply: !!threadID }); QR.cooldown.auto = QR.replies.length > 1; - if (threadID === '0') { + if (!threadID) { $.open("//boards.4chan.org/" + g.BOARD + "/res/" + postID); } else if (g.VIEW === 'reply' && !QR.cooldown.auto) { $.open("//boards.4chan.org/" + g.BOARD + "/res/" + threadID + "#p" + postID); diff --git a/src/features.coffee b/src/features.coffee index f0449c0ac..dea879758 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -3312,7 +3312,7 @@ Unread = Unread.addPosts e.detail.newPosts post: (e) -> - Unread.yourPosts.push +e.detail.postID + Unread.yourPosts.push e.detail.postID read: (e) -> return if d.hidden or !Unread.posts.length @@ -3511,7 +3511,7 @@ ThreadUpdater = ThreadUpdater.set 'status', 'Offline', 'warning' ThreadUpdater.cb.autoUpdate() 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 setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2 visibility: -> @@ -3770,12 +3770,12 @@ ThreadWatcher = thread = @nextElementSibling.pathname.split '/' ThreadWatcher.unwatch thread[1], thread[3] post: (e) -> - {postID, threadID} = e.detail - if threadID is '0' + {board, postID, threadID} = e.detail + if postID is threadID if Conf['Auto Watch'] - $.set 'AutoWatch', +postID + $.set 'AutoWatch', threadID else if Conf['Auto Watch Reply'] - ThreadWatcher.watch g.BOARD.threads[threadID] + ThreadWatcher.watch board.threads[threadID] toggle: (thread) -> if $('.favicon', thread.OP.nodes.post).src is Favicon.empty diff --git a/src/qr.coffee b/src/qr.coffee index 8be628f6d..58a517f6f 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -786,21 +786,24 @@ QR = $.set 'QR.persona', persona [_, threadID, postID] = h1.nextSibling.textContent.match /thread:(\d+),no:(\d+)/ + threadID = +threadID + postID = +postID # Post/upload confirmed as successful. $.event 'QRPostSuccessful', { - threadID + board: g.BOARD + threadID: threadID or postID postID }, QR.el QR.cooldown.set post: reply - isReply: threadID isnt '0' + isReply: !!threadID # Enable auto-posting if we have stuff to post, disable it otherwise. 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}" else if g.VIEW is 'reply' and !QR.cooldown.auto # posting from the index $.open "//boards.4chan.org/#{g.BOARD}/res/#{threadID}#p#{postID}"