reverted:
--- b/recaptcha/drupal-recaptcha.js
+++ /dev/null
@@ -1,28 +0,0 @@
-(function ($, window, document) {
-
-Drupal.behaviors.recaptcha = {
- attach: function (context, settings) {
- $('.g-recaptcha', context).each(function() {
- if (typeof grecaptcha == 'undefined') {
- return;
- }
- if ($(this).hasClass('drupal-recaptcha-processed')) {
- grecaptcha.reset();
- }
- else {
- grecaptcha.render(this, $(this).data());
- $(this).addClass('drupal-recaptcha-processed');
- }
-
- });
- }
-}
-
-window.drupalRecaptchaOnload = function() {
- $('.g-recaptcha').each(function() {
- grecaptcha.render(this, $(this).data());
- $(this).addClass('drupal-recaptcha-processed');
- });
-}
-})(jQuery, window, document);
-
reverted:
--- b/recaptcha/recaptcha.module
+++ a/recaptcha/recaptcha.module
@@ -114,16 +114,20 @@
$captcha['form']['recaptcha_widget'] = array(
'#markup' => '
',
'#suffix' => $noscript,
+ );
+
+ // @todo: #1664602: D7 does not yet support "async" in drupal_add_js().
+ // drupal_add_js(url('https://www.google.com/recaptcha/api.js', array('query' => array('hl' => $language->language), 'absolute' => TRUE)), array('defer' => TRUE, 'async' => TRUE, 'type' => 'external'));
+ $data = array(
+ '#tag' => 'script',
+ '#value' => '',
+ '#attributes' => array(
+ 'src' => url('https://www.google.com/recaptcha/api.js', array('query' => array('hl' => $language->language), 'absolute' => TRUE)),
+ 'async' => 'async',
+ 'defer' => 'defer',
- '#attached' => array(
- 'js' => array(
- drupal_get_path('module', 'recaptcha') . '/drupal-recaptcha.js',
- array(
- 'data' => url('https://www.google.com/recaptcha/api.js', array('query' => array('hl' => $language->language, 'render' => 'explicit', 'onload' => 'drupalRecaptchaOnload'), 'absolute' => TRUE)),
- 'type' => 'external',
- ),
- ),
),
);
+ drupal_add_html_head($data, 'recaptcha_api');
}
else {
// Fallback to Math captcha as reCAPTCHA is not configured.
reverted:
--- b/recaptcha/recaptcha.test
+++ a/recaptcha/recaptcha.test
@@ -128,7 +128,7 @@
// Check if there is a reCAPTCHA on the login form.
$this->drupalGet('user');
$this->assertRaw($grecaptcha, '[testReCaptchaOnLoginForm]: reCAPTCHA is shown on form.');
+ $this->assertRaw('', '[testReCaptchaOnLoginForm]: reCAPTCHA is shown on form.');
- $this->assertRaw('', '[testReCaptchaOnLoginForm]: reCAPTCHA is shown on form.');
$this->assertNoRaw($grecaptcha . '