Skip to content
Snippets Groups Projects

Resolve #2493183 "8.x 3.x ajax support 273"

12 files
+ 526
29
Compare changes
  • Side-by-side
  • Inline
Files
12
js/recaptcha.js 0 → 100644
+ 34
0
 
/**
 
* @file
 
* Contains the definition of the behaviour recaptcha.
 
*/
 
 
(function ($, Drupal) {
 
Drupal.behaviors.recaptcha = {
 
attach: function (context) {
 
$('.g-recaptcha', context).each(function () {
 
if (typeof grecaptcha === 'undefined' || typeof grecaptcha.render !== 'function') {
 
return;
 
}
 
if ($(this).closest('body').length > 0) {
 
if ($(this).hasClass('recaptcha-processed')) {
 
grecaptcha.reset();
 
}
 
else {
 
grecaptcha.render(this, $(this).data());
 
$(this).addClass('recaptcha-processed');
 
}
 
}
 
});
 
}
 
};
 
 
window.drupalRecaptchaOnload = function () {
 
$('.g-recaptcha').each(function () {
 
if (!$(this).hasClass('recaptcha-processed')) {
 
grecaptcha.render(this, $(this).data());
 
$(this).addClass('recaptcha-processed');
 
}
 
});
 
};
 
})(jQuery, Drupal);
Loading