| Total Complexity | 6 |
| Complexity/F | 1.5 |
| Lines of Code | 32 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
| 1 | 'use strict'; |
||
| 2 | |||
| 3 | function reCaptchaInit() { |
||
| 4 | var element = document.createElement('script'), |
||
| 5 | target = document.querySelectorAll('script')[0], |
||
| 6 | protocol = 'https:' == document.location.protocol ? 'https' : 'http'; |
||
| 7 | element.type = 'text/javascript'; |
||
| 8 | element.src = protocol + '://www.google.com/recaptcha/api.js?onload=reCaptchaOnloadCallback&render=explicit&hl='.concat(window.SS_LOCALE); |
||
| 9 | target.parentNode.insertBefore(element, target); |
||
| 10 | } |
||
| 11 | |||
| 12 | function reCaptchaOnloadCallback() { |
||
| 13 | var reCaptcha = document.querySelector('.g-recaptcha'); |
||
| 14 | |||
| 15 | if (reCaptcha.dataset.size === 'invisible') { |
||
| 16 | document.querySelector('#'.concat(window.ReCaptchaFormId)).addEventListener('submit', reCaptchaFormOnSubmit); |
||
| 17 | } |
||
| 18 | |||
| 19 | grecaptcha.render(reCaptcha, reCaptcha.dataset); |
||
|
|
|||
| 20 | } |
||
| 21 | |||
| 22 | function reCaptchaOnSubmit(token) { |
||
| 23 | document.querySelector('#'.concat(window.ReCaptchaFormId, ' .g-recaptcha-response')).value = token; |
||
| 24 | document.querySelector('#'.concat(window.ReCaptchaFormId)).submit(); |
||
| 25 | } |
||
| 26 | |||
| 27 | function reCaptchaFormOnSubmit(event) { |
||
| 28 | event.preventDefault(); |
||
| 29 | grecaptcha.execute(); |
||
| 30 | } |
||
| 31 | |||
| 32 | domReady(reCaptchaInit); |
||
| 33 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.