PageSourceSearch

https://cropprotectionnetwork.org/vendor/statamic-recaptcha/js/rec…?v=83dbc59c46e88121427844e6a7b01e80

js cropprotectionnetwork.org collected 2026-10-02 06:23:55 UTC 2,265 bytes, 76 lines download raw bytes

1if (window.recaptchaV2) {
2
3  // Check for reCAPTCHA config.
4  if (
5    window.recaptchaV2.siteKey == 'undefined' ||
6    window.recaptchaV2.siteKey == ''
7  ) {
8    console.warn('A RECAPTCHA_V2_SITE_KEY has not been set in .env')
9  }
10
11  // reCAPTCHA v2
12  const recaptchaScript = document.createElement('script')
13  document.head.appendChild(recaptchaScript)
14  recaptchaScript.type = 'text/javascript'
15  recaptchaScript.setAttribute('async', true)
16  recaptchaScript.setAttribute('defer', true)
17
18  // Build the URL.
19  recaptchaScript.src = (function() {
20    const baseUrl = 'https://www.google.com/recaptcha/api.js'
21    let params = {
22      onload: 'onloadRecaptchaCallback',
23      render: 'explicit',
24    }
25
26    if (window.recaptchaV2.lang) {
27      params.hl = window.recaptchaV2.lang
28    }
29
30    const url = new URL(baseUrl)
31    for (const key in params) {
32      url.searchParams.append(key, params[key])
33    }
34
35    return url.toString()
36  })()
37
38  // reCAPTCHA is ready.
39  function onloadRecaptchaCallback() {
40    const forms = document.querySelectorAll('form:not(.nocaptcha)')
41
42    for (let i = 0; i < forms.length; i++) {
43
44      // Invisible
45      if (window.recaptchaV2.size == 'invisible') {
46        if (forms[i].querySelector('button[type="submit"]')) {
47          grecaptcha.render(forms[i].querySelector('button[type="submit"]'), {
48            sitekey: window.recaptchaV2.siteKey,
49            size: 'invisible',
50            callback: function(token) {
51              forms[i].querySelector('button[type="submit"]').disabled = true
52
53              const tokenInput = document.createElement('input')
54              tokenInput.type = 'hidden'
55              tokenInput.name = 'g-recaptcha-response'
56              tokenInput.value = token
57              forms[i].appendChild(tokenInput)
58              forms[i].submit()
59            }
60          })
61        }
62
63      // Checkbox
64      } else {
65        if (forms[i].querySelector('.g-recaptcha')) {
66          grecaptcha.render(forms[i].querySelector('.g-recaptcha'), {
67            sitekey: window.recaptchaV2.siteKey,
68            theme: window.recaptchaV2.theme || 'light',
69            size: window.recaptchaV2.size || 'normal',
70            tabindex: window.recaptchaV2.tabindex || 0
71          })
72        }
73      }
74    }
75  }
76}

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.