move auto auto post into qr

This commit is contained in:
James Campos 2011-08-06 10:07:17 -07:00
parent 5eb88f735f
commit 9adfa5f866
2 changed files with 18 additions and 12 deletions

View File

@ -1280,6 +1280,15 @@
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
return $('#recaptcha_challenge_field', qr.el).value = target.value;
},
captchaKeydown: function(e) {
if (e.keyCode === 13 && cooldown.duration) {
$('#auto', qr.el).checked = true;
if (conf['Auto Hide QR']) {
qr.autohide.set();
}
return qr.push.call(this);
}
},
cb: {
autohide: function(e) {
if (this.checked) {
@ -1320,6 +1329,7 @@
$.bind($('a[name=attach]', qr.el), 'click', qr.attach);
$.bind($('img', qr.el), 'click', Recaptcha.reload);
$.bind($('#recaptcha_response_field', qr.el), 'keydown', Recaptcha.listener);
$.bind($('#recaptcha_response_field', qr.el), 'keydown', qr.captchaKeydown);
return $.append(d.body, qr.el);
},
message: function(e) {
@ -2485,14 +2495,7 @@
},
listener: function(e) {
if (e.keyCode === 8 && this.value === '') {
Recaptcha.reload();
}
if (e.keyCode === 13 && cooldown.duration) {
$('#auto', qr.el).checked = true;
if (conf['Auto Hide QR']) {
qr.autohide.set();
}
return qr.push.call(this);
return Recaptcha.reload();
}
},
reload: function() {

View File

@ -1009,6 +1009,12 @@ qr =
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
$('#recaptcha_challenge_field', qr.el).value = target.value
captchaKeydown: (e) ->
if e.keyCode is 13 and cooldown.duration # press enter to enable auto-post if cooldown is still running
$('#auto', qr.el).checked = true
qr.autohide.set() if conf['Auto Hide QR']
qr.push.call this
cb:
autohide: (e) ->
if @checked
@ -1064,6 +1070,7 @@ qr =
$.bind $('a[name=attach]', qr.el), 'click', qr.attach
$.bind $('img', qr.el), 'click', Recaptcha.reload
$.bind $('#recaptcha_response_field', qr.el), 'keydown', Recaptcha.listener
$.bind $('#recaptcha_response_field', qr.el), 'keydown', qr.captchaKeydown
$.append d.body, qr.el
@ -1894,10 +1901,6 @@ Recaptcha =
listener: (e) ->
if e.keyCode is 8 and @value is '' # backspace to reload
Recaptcha.reload()
if e.keyCode is 13 and cooldown.duration # press enter to enable auto-post if cooldown is still running
$('#auto', qr.el).checked = true
qr.autohide.set() if conf['Auto Hide QR']
qr.push.call this
reload: ->
window.location = 'javascript:Recaptcha.reload()'