try to fix qr image posting

This commit is contained in:
James Campos 2011-04-03 13:04:58 -07:00
parent cb966b9b60
commit 3ef9107232
2 changed files with 18 additions and 18 deletions

View File

@ -971,8 +971,8 @@
} }
}, },
messageIframe: function(e) { messageIframe: function(e) {
var message; var message, _ref;
message = $('table b').firstChild.textContent; message = ((_ref = $('table font b')) != null ? _ref.firstChild.textContent : void 0) || '';
e.source.postMessage(message, '*'); e.source.postMessage(message, '*');
return window.location = 'about:blank'; return window.location = 'about:blank';
}, },
@ -980,7 +980,14 @@
var data, dialog, error; var data, dialog, error;
data = e.data; data = e.data;
dialog = $('#qr'); 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 (dialog) {
if ($.config('Persistent QR')) { if ($.config('Persistent QR')) {
qr.refresh(dialog); qr.refresh(dialog);
@ -988,13 +995,6 @@
$.remove(dialog); $.remove(dialog);
} }
} }
} else {
error = $.el('span', {
className: 'error',
textContent: data
});
$.append(dialog, error);
qr.autohide.unset();
} }
return recaptchaReload(); return recaptchaReload();
}, },

View File

@ -717,25 +717,25 @@ qr =
recaptchaReload() recaptchaReload()
messageIframe: (e) -> messageIframe: (e) ->
message = $('table b').firstChild.textContent message = $('table font b')?.firstChild.textContent or ''
e.source.postMessage message, '*' e.source.postMessage message, '*'
window.location = 'about:blank' window.location = 'about:blank'
messageTop: (e) -> messageTop: (e) ->
{data} = e {data} = e
dialog = $ '#qr' dialog = $ '#qr'
if data is 'Post successful!' if data # error message
if dialog
if $.config 'Persistent QR'
qr.refresh dialog
else
$.remove dialog
else
error = $.el 'span', error = $.el 'span',
className: 'error' className: 'error'
textContent: data textContent: data
$.append dialog, error $.append dialog, error
qr.autohide.unset() qr.autohide.unset()
else
if dialog
if $.config 'Persistent QR'
qr.refresh dialog
else
$.remove dialog
recaptchaReload() recaptchaReload()