From cc99beb51ee7d6bef525a432d867fc7e095a4918 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 11 Apr 2011 03:07:28 -0700 Subject: [PATCH] fix qr image posting --- 4chan_x.js | 20 ++++++++++---------- script.coffee | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index e2bdf6c8a..0dbfb27c2 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -972,8 +972,8 @@ } }, messageIframe: function(e) { - var message; - message = $('table b').firstChild.textContent; + var message, _ref; + message = (_ref = $('table font b')) != null ? _ref.firstChild.textContent : void 0; e.source.postMessage(message, '*'); return window.location = 'about:blank'; }, @@ -981,7 +981,14 @@ var data, dialog, error; data = e.data; dialog = $('#qr'); - if (data === 'Post successful!') { + if (data) { + error = $.el('span', { + className: 'error', + textContent: data + }); + $.append(dialog, error); + qr.autohide.unset(); + } else { if (dialog) { if ($.config('Persistent QR')) { qr.refresh(dialog); @@ -989,13 +996,6 @@ $.remove(dialog); } } - } else { - error = $.el('span', { - className: 'error', - textContent: data - }); - $.append(dialog, error); - qr.autohide.unset(); } return recaptchaReload(); }, diff --git a/script.coffee b/script.coffee index f03ff3502..f464315bd 100644 --- a/script.coffee +++ b/script.coffee @@ -716,25 +716,25 @@ qr = $.remove dialog messageIframe: (e) -> - message = $('table b').firstChild.textContent + message = $('table font b')?.firstChild.textContent e.source.postMessage message, '*' window.location = 'about:blank' messageTop: (e) -> {data} = e dialog = $ '#qr' - if data is 'Post successful!' - if dialog - if $.config 'Persistent QR' - qr.refresh dialog - else - $.remove dialog - else + if data # error message error = $.el 'span', className: 'error' textContent: data $.append dialog, error qr.autohide.unset() + else + if dialog + if $.config 'Persistent QR' + qr.refresh dialog + else + $.remove dialog recaptchaReload()