1var key = gfGoogleCaptchaScriptFrontend_strings.key 2 3grecaptcha.ready(function() { 4 for (var i = 0; i < document.forms.length; ++i) { 5 var form = document.forms[i] 6 7 var holder = form.querySelector('.gf-recaptcha-div') 8 9 if (null === holder) continue 10 holder.innerHTML = '' 11 ;(function(frm) { 12 // This sets everything up for the form call 13 var holderId = grecaptcha.render(holder, { 14 sitekey: key, 15 size: 'invisible', 16 badge: 'inline', 17 }) 18 19 // Here the form is submitted, using everything from, above 20 frm.addEventListener('submit', function(evt) { 21 evt.preventDefault() 22 // Execute and get token 23 grecaptcha 24 .execute(holderId, { action: form.id }) 25 .then(function(token) { 26 // Take token and pass to server 27 tellServer(token, frm) 28 }) 29 }) 30 })(form) 31 } 32}) 33 34function tellServer(token, frm) { 35 var data = { 36 action: 'check_google_token_request', 37 token: token, 38 security: gfGoogleCaptchaScriptFrontend_strings.security, 39 } 40 41 axios 42 .post(gfGoogleCaptchaScriptFrontend_strings.ajaxurl, Qs.stringify(data)) 43 .then(function(response) { 44 if (response.data.success) { 45 var recaptchaFields = document.querySelector( 46 '[data-type="recaptcha-score"]' 47 ) 48 if (recaptchaFields) { 49 recaptchaFields.value = response.data.score 50 } 51 frm.submit() 52 } else { 53 console.log('Is a bot') 54 } 55 }) 56 .catch(function(error) { 57 // handle error 58 console.log(error) 59 }) 60}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.