diff --git a/4chan_x.user.js b/4chan_x.user.js index c1cab46f4..1bdc4a114 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2596,7 +2596,7 @@ return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts); }, response: function(html) { - var ban, board, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1; + var ban, board, doc, err, persona, postID, reply, threadID, _, _ref, _ref1; doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; if (ban = $('.banType', doc)) { @@ -2608,7 +2608,7 @@ if ((_ref = $('a', err)) != null) { _ref.target = '_blank'; } - } else if (!(msg = $('b', doc))) { + } else if (doc.title !== 'Post successful!') { err = 'Connection error with sys.4chan.org.'; } if (err) { @@ -2635,7 +2635,7 @@ sub: Conf['Remember Subject'] ? reply.sub : null }; $.set('QR.persona', persona); - _ref1 = msg.lastChild.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2]; + _ref1 = doc.body.lastChild.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2]; $.event(QR.el, new CustomEvent('QRPostSuccessful', { bubbles: true, detail: { diff --git a/changelog b/changelog index 72d0455e3..e521b62eb 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix successful posting causing errors. 2.37.2 - aeosynth diff --git a/script.coffee b/script.coffee index b934f446c..8a59673b4 100644 --- a/script.coffee +++ b/script.coffee @@ -2060,7 +2060,7 @@ QR = "Reason: #{$('.reason', doc).innerHTML}" else if err = doc.getElementById 'errmsg' # error! $('a', err)?.target = '_blank' # duplicate image link - else unless msg = $ 'b', doc + else if doc.title isnt 'Post successful!' err = 'Connection error with sys.4chan.org.' if err @@ -2096,7 +2096,7 @@ QR = sub: if Conf['Remember Subject'] then reply.sub else null $.set 'QR.persona', persona - [_, threadID, postID] = msg.lastChild.textContent.match /thread:(\d+),no:(\d+)/ + [_, threadID, postID] = doc.body.lastChild.textContent.match /thread:(\d+),no:(\d+)/ # Post/upload confirmed as successful. $.event QR.el, new CustomEvent 'QRPostSuccessful',