CoreFiles by mySites.guru
recaptcha.js31 lines, 1,117 bytes, from Joomla_5.4.5-Stable-Full_Package.zip
Raw History Compare with 5.4.4
md5
360d4d85cfdd2767d5f778e3b310e386
sha1
0cb3f44e4ef64dc4a253f100bd3297f72d95e9c5
sha256
0ad3fb6f2d0203767a7130cbac2c13bcaf1d47783554f391ac5bf2564694bfe3
/**
 * @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 optionKeys = ['sitekey', 'badge', 'size', 'tabindex', 'callback', 'expired-callback', 'error-callback'];
    document.querySelectorAll('.g-recaptcha').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 57 releases, Joomla 5.2.2-rc1 to 5.4.12. See them all, or every version of this file.