src/InvisibleReCaptcha.php
public function renderFooterJS($lang = null)
    {
        $html = '<script src="' . $this->getCaptchaJs($lang) . '" async defer></script>' . PHP_EOL;
        $html .= '<script>var _submitForm,_captchaForm,_captchaSubmit,_execute=true;</script>';
        $html .= "<script>window.addEventListener('load', _loadCaptcha);" . PHP_EOL;
        $html .= "function _loadCaptcha(){";
        if ($this->getOption('hideBadge', false)) {
            $html .= "document.querySelector('.grecaptcha-badge').style = 'display:none;!important'" . PHP_EOL;
        }
        $html .= '_captchaForm=document.querySelector("#_g-recaptcha").closest("form");';
        $html .= "_captchaSubmit=_captchaForm.querySelector('[type=submit]');";
        $html .= '_submitForm=function(){if(typeof _submitEvent==="function"){_submitEvent();';
        $html .= 'grecaptcha.reset();}else{_captchaForm.submit();}};';
        $html .= "_captchaForm.addEventListener('submit',";
        $html .= "function(e){e.preventDefault();if(typeof _beforeSubmit==='function'){";
        $html .= "_execute=_beforeSubmit(e);}if(_execute){grecaptcha.execute();}});";
        if ($this->getOption('debug', false)) {
            $html .= $this->renderDebug();
        }
        $html .= "}</script>" . PHP_EOL;
        return $html;
    }
public function renderFooterJS($lang = null)
    {
        $html = '<script src="' . $this->getCaptchaJs($lang) . '" async defer></script>' . PHP_EOL;
        $html .= '<script>var _submitForm,_captchaForm,_captchaSubmit,_execute=true;</script>';
        $html .= "<script>window.addEventListener('load', _loadCaptcha);" . PHP_EOL;
        $html .= "function _loadCaptcha(){";
        if ($this->getOption('hideBadge', false)) {
            $html .= "document.querySelector('.grecaptcha-badge').style = 'display:none;!important'" . PHP_EOL;
        }
        $html .= '_captchaForm=document.querySelector("#_g-recaptcha").closest("form");';
        $html .= "_captchaSubmit=_captchaForm.querySelector('[type=submit]');";
        $html .= '_submitForm=function(){if(typeof _submitEvent==="function"){_submitEvent();';
        $html .= 'grecaptcha.reset();}else{_captchaForm.submit();}};';
        $html .= "_captchaForm.addEventListener('submit',";
        $html .= "function(e){e.preventDefault();if(typeof _beforeSubmit==='function'){";
        $html .= "_execute=_beforeSubmit(e);}if(_execute){grecaptcha.execute();}});";
        if ($this->getOption('debug', false)) {
            $html .= $this->renderDebug();
        }
        $html .= "}</script>" . PHP_EOL;
        return $html;
    }
public function renderFooterJS ( $ lang = null ) { $ html = '<script src="' . $ this -> getCaptchaJs ( $ lang ) . '" async defer></script>' . PHP_EOL ; $ html .= '<script>var _submitForm,_captchaForm,_captchaSubmit,_execute=true;</script>' ; $ html .= "<script>window.addEventListener('load', _loadCaptcha);" . PHP_EOL ; $ html .= "function _loadCaptcha(){" ; if ( $ this -> getOption ( 'hideBadge' , false ) ) { $ html .= "document.querySelector('.grecaptcha-badge').style = 'display:none;!important'" . PHP_EOL ; } $ html .= '_captchaForm=document.querySelector("#_g-recaptcha").closest("form");' ; $ html .= "_captchaSubmit=_captchaForm.querySelector('[type=submit]');" ; $ html .= '_submitForm=function(){if(typeof _submitEvent==="function"){_submitEvent();' ; $ html .= 'grecaptcha.reset();}else{_captchaForm.submit();}};' ; $ html .= "_captchaForm.addEventListener('submit'," ; $ html .= "function(e){e.preventDefault();if(typeof _beforeSubmit==='function'){" ; $ html .= "_execute=_beforeSubmit(e);}if(_execute){grecaptcha.execute();}});" ; if ( $ this -> getOption ( 'debug' , false ) ) { $ html .= $ this -> renderDebug ( ) ; } $ html .= "}</script>" . PHP_EOL ; return $ html ; }
Render the footer JS neccessary for the recaptcha integration.

@return string
Render the footer JS neccessary for the recaptcha integration .