refactor qr.cb.message

This commit is contained in:
James Campos 2011-06-11 09:55:56 -07:00
parent ee7b8c1bd6
commit 5a173043e4
2 changed files with 27 additions and 26 deletions

View File

@ -1103,13 +1103,16 @@
}, },
message: function(e) { message: function(e) {
var data, dialog, duration; var data, dialog, duration;
Recaptcha.reload();
$('iframe[name=iframe]').src = 'about:blank';
data = e.data; data = e.data;
dialog = $('#qr'); dialog = $('#qr');
if (data) { if (data) {
$('input[name=recaptcha_response_field]', dialog).value = ''; $('input[name=recaptcha_response_field]', dialog).value = '';
$('#error').textContent = data; $('#error').textContent = data;
qr.autohide.unset(); qr.autohide.unset();
} else { return;
}
if (dialog) { if (dialog) {
if (g.REPLY && $.config('Persistent QR')) { if (g.REPLY && $.config('Persistent QR')) {
qr.refresh(dialog); qr.refresh(dialog);
@ -1120,11 +1123,8 @@
if ($.config('Cooldown')) { if ($.config('Cooldown')) {
duration = qr.sage ? 60 : 30; duration = qr.sage ? 60 : 30;
$.setValue(g.BOARD + '/cooldown', Date.now() + duration * 1000); $.setValue(g.BOARD + '/cooldown', Date.now() + duration * 1000);
cooldown.start(); return cooldown.start();
} }
}
Recaptcha.reload();
return $('iframe[name=iframe]').src = 'about:blank';
}, },
node: function(root) { node: function(root) {
var quote; var quote;

View File

@ -854,13 +854,17 @@ qr =
$.removeClass dialog, 'auto' $.removeClass dialog, 'auto'
message: (e) -> message: (e) ->
Recaptcha.reload()
$('iframe[name=iframe]').src = 'about:blank'
{data} = e {data} = e
dialog = $ '#qr' dialog = $ '#qr'
if data # error message if data # error message
$('input[name=recaptcha_response_field]', dialog).value = '' $('input[name=recaptcha_response_field]', dialog).value = ''
$('#error').textContent = data $('#error').textContent = data
qr.autohide.unset() qr.autohide.unset()
else # success return
if dialog if dialog
if g.REPLY and $.config 'Persistent QR' if g.REPLY and $.config 'Persistent QR'
qr.refresh dialog qr.refresh dialog
@ -871,9 +875,6 @@ qr =
$.setValue g.BOARD+'/cooldown', Date.now() + duration * 1000 $.setValue g.BOARD+'/cooldown', Date.now() + duration * 1000
cooldown.start() cooldown.start()
Recaptcha.reload()
$('iframe[name=iframe]').src = 'about:blank'
node: (root) -> node: (root) ->
quote = $ 'a.quotejs:not(:first-child)', root quote = $ 'a.quotejs:not(:first-child)', root
$.bind quote, 'click', qr.cb.quote $.bind quote, 'click', qr.cb.quote