CoreFiles by mySites.guru
recaptcha.js32 lines, 1,168 bytes, from Joomla_5.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 5.0.0-beta1
md5
bc1bec32a19a924bba2ff5fad545af0b
sha1
fd91cf2cdb524d6b1866ee40708c044ee50ad1e5
sha256
d3764642b7332375bcf4d7d9111614b43b56760ba8cfdc6f5350810de756dc08
/**
 * @package     Joomla.JavaScript
 * @copyright   (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

((window, document) => {

  window.JoomlainitReCaptchaInvisible = () => {
    const elements = [].slice.call(document.getElementsByClassName('g-recaptcha'));
    const optionKeys = ['sitekey', 'badge', 'size', 'tabindex', 'callback', 'expired-callback', 'error-callback'];
    elements.forEach(element => {
      let options = {};
      if (element.dataset) {
        options = element.dataset;
      } else {
        optionKeys.forEach(key => {
          const optionKeyFq = `data-${optionKeys[key]}`;
          if (element.hasAttribute(optionKeyFq)) {
            options[optionKeys[key]] = element.getAttribute(optionKeyFq);
          }
        });
      }

      // Set the widget id of the recaptcha item
      element.setAttribute('data-recaptcha-widget-id', window.grecaptcha.render(element, options));

      // Execute the invisible reCAPTCHA
      window.grecaptcha.execute(element.getAttribute('data-recaptcha-widget-id'));
    });
  };
})(window, document);

The same content is in 94 releases, Joomla 4.3.0-alpha1 to 5.1.4. See them all, or every version of this file.