Recaptcha.reloaded -> qr.captchaNode
This commit is contained in:
parent
7100f51f7d
commit
5eb88f735f
@ -1238,6 +1238,7 @@
|
|||||||
$.append(d.body, iframe);
|
$.append(d.body, iframe);
|
||||||
$.bind(window, 'message', qr.message);
|
$.bind(window, 'message', qr.message);
|
||||||
$('#recaptcha_response_field').id = '';
|
$('#recaptcha_response_field').id = '';
|
||||||
|
$.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode);
|
||||||
return qr.captcha = [];
|
return qr.captcha = [];
|
||||||
},
|
},
|
||||||
attach: function() {
|
attach: function() {
|
||||||
@ -1270,6 +1271,15 @@
|
|||||||
return (_ref = $('#autohide:checked', qr.el)) != null ? _ref.click() : void 0;
|
return (_ref = $('#autohide:checked', qr.el)) != null ? _ref.click() : void 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
captchaNode: function(e) {
|
||||||
|
var target;
|
||||||
|
if (!qr.el) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target = e.target;
|
||||||
|
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
||||||
|
return $('#recaptcha_challenge_field', qr.el).value = target.value;
|
||||||
|
},
|
||||||
cb: {
|
cb: {
|
||||||
autohide: function(e) {
|
autohide: function(e) {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
@ -2471,7 +2481,6 @@
|
|||||||
el = _ref2[_i];
|
el = _ref2[_i];
|
||||||
el.tabIndex = 1;
|
el.tabIndex = 1;
|
||||||
}
|
}
|
||||||
$.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', Recaptcha.reloaded);
|
|
||||||
return $.bind($('#recaptcha_response_field'), 'keydown', Recaptcha.listener);
|
return $.bind($('#recaptcha_response_field'), 'keydown', Recaptcha.listener);
|
||||||
},
|
},
|
||||||
listener: function(e) {
|
listener: function(e) {
|
||||||
@ -2488,15 +2497,6 @@
|
|||||||
},
|
},
|
||||||
reload: function() {
|
reload: function() {
|
||||||
return window.location = 'javascript:Recaptcha.reload()';
|
return window.location = 'javascript:Recaptcha.reload()';
|
||||||
},
|
|
||||||
reloaded: function(e) {
|
|
||||||
var target;
|
|
||||||
if (!qr.el) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
target = e.target;
|
|
||||||
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
|
||||||
return $('#recaptcha_challenge_field', qr.el).value = target.value;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
nodeInserted = function(e) {
|
nodeInserted = function(e) {
|
||||||
|
|||||||
@ -979,6 +979,8 @@ qr =
|
|||||||
|
|
||||||
#hack - nuke id so it doesn't grab focus when reloading
|
#hack - nuke id so it doesn't grab focus when reloading
|
||||||
$('#recaptcha_response_field').id = ''
|
$('#recaptcha_response_field').id = ''
|
||||||
|
|
||||||
|
$.bind $('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode
|
||||||
qr.captcha = []
|
qr.captcha = []
|
||||||
|
|
||||||
attach: ->
|
attach: ->
|
||||||
@ -1001,6 +1003,12 @@ qr =
|
|||||||
unset: ->
|
unset: ->
|
||||||
$('#autohide:checked', qr.el)?.click()
|
$('#autohide:checked', qr.el)?.click()
|
||||||
|
|
||||||
|
captchaNode: (e) ->
|
||||||
|
return unless qr.el
|
||||||
|
{target} = e
|
||||||
|
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
||||||
|
$('#recaptcha_challenge_field', qr.el).value = target.value
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
autohide: (e) ->
|
autohide: (e) ->
|
||||||
if @checked
|
if @checked
|
||||||
@ -1882,7 +1890,6 @@ Recaptcha =
|
|||||||
#hack to tab from comment straight to recaptcha
|
#hack to tab from comment straight to recaptcha
|
||||||
for el in $$ '#recaptcha_table a'
|
for el in $$ '#recaptcha_table a'
|
||||||
el.tabIndex = 1
|
el.tabIndex = 1
|
||||||
$.bind $('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', Recaptcha.reloaded
|
|
||||||
$.bind $('#recaptcha_response_field'), 'keydown', Recaptcha.listener
|
$.bind $('#recaptcha_response_field'), 'keydown', Recaptcha.listener
|
||||||
listener: (e) ->
|
listener: (e) ->
|
||||||
if e.keyCode is 8 and @value is '' # backspace to reload
|
if e.keyCode is 8 and @value is '' # backspace to reload
|
||||||
@ -1893,11 +1900,6 @@ Recaptcha =
|
|||||||
qr.push.call this
|
qr.push.call this
|
||||||
reload: ->
|
reload: ->
|
||||||
window.location = 'javascript:Recaptcha.reload()'
|
window.location = 'javascript:Recaptcha.reload()'
|
||||||
reloaded: (e) ->
|
|
||||||
return unless qr.el
|
|
||||||
{target} = e
|
|
||||||
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
|
||||||
$('#recaptcha_challenge_field', qr.el).value = target.value
|
|
||||||
|
|
||||||
nodeInserted = (e) ->
|
nodeInserted = (e) ->
|
||||||
{target} = e
|
{target} = e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user