CoreFiles by mySites.guru
recaptcha.js31 lines, 1,122 bytes, from Joomla_5.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 5.2.0-beta2
md5
dfacdb854e8dda5777ac77929328e18e
sha1
0b9389b7712cc31ede2004b1b546f5a86653cef2
sha256
5b75bba1ea556b59b968cc66d6eb61ac3fa6b895159e1757ec823a864967799b
/**
 * @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.getElementsByClassName('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 12 releases, Joomla 5.2.0-alpha1 to 5.2.1. See them all, or every version of this file.