[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/plg_captcha_recaptcha_invisible/js/ -> recaptcha.js (source)

   1  /**
   2   * @package     Joomla.JavaScript
   3   * @copyright   (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   4   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  ((window, document) => {
   7  
   8    window.JoomlainitReCaptchaInvisible = () => {
   9      const elements = [].slice.call(document.getElementsByClassName('g-recaptcha'));
  10      const optionKeys = ['sitekey', 'badge', 'size', 'tabindex', 'callback', 'expired-callback', 'error-callback'];
  11      elements.forEach(element => {
  12        let options = {};
  13  
  14        if (element.dataset) {
  15          options = element.dataset;
  16        } else {
  17          optionKeys.forEach(key => {
  18            const optionKeyFq = `data-$optionKeys[key]}`;
  19  
  20            if (element.hasAttribute(optionKeyFq)) {
  21              options[optionKeys[key]] = element.getAttribute(optionKeyFq);
  22            }
  23          });
  24        } // Set the widget id of the recaptcha item
  25  
  26  
  27        element.setAttribute('data-recaptcha-widget-id', window.grecaptcha.render(element, options)); // Execute the invisible reCAPTCHA
  28  
  29        window.grecaptcha.execute(element.getAttribute('data-recaptcha-widget-id'));
  30      });
  31    };
  32  })(window, document);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer