1if (window.recaptcha_key) { 2 $(document).ready(function () { 3 4 setTimeout(function () { 5 6 if (typeof grecaptcha !== 'undefined' && grecaptcha) { 7 grecaptcha.ready(function () { 8 grecaptcha.execute(window.recaptcha_key, { action: 'submit2' }).then(function (token) { 9 if (token && document.getElementById('recaptchaResponse')) { 10 document.getElementById('recaptchaResponse').value = token; 11 } 12 }); 13 }); 14 } 15 16 }, 1000); 17 18 const recaptchaForms = [ 19 'form.staff-contact-form:not(.skip-grecaptcha)', 20 'form.custom-form:not(.skip-grecaptcha)', 21 'form.vacancy-form:not(.skip-grecaptcha)', 22 'form.reunion-register-form:not(.skip-grecaptcha)', 23 'form.donation-form:not(.skip-grecaptcha)', 24 'form.ecommerce-checkout-form:not(.skip-grecaptcha)', 25 ].join(', '); 26 27 //$('form.staff-contact-form, form.custom-form, form.vacancy-form, reunion-register-form').on('submit', function(e) { 28 $(document).on('submit', recaptchaForms, 29 function (e) { 30 const $form = $(this); 31 const form = this; 32 const $button = $form.find('button[type=submit]'); 33 // Add spinner if not exists 34 if ($button.find('.spinner-icon').length === 0) { 35 const $spinner = $('<span class="spinner-icon"><i class="fas fa-sync-alt fa-spin"></i></span>'); 36 $button.prepend($spinner); 37 } 38 $button.prop('disabled', true); 39 40 // reCAPTCHA v3 41 if (typeof grecaptcha !== 'undefined') { 42 e.preventDefault(); 43 44 grecaptcha.ready(function () { 45 grecaptcha.execute(window.recaptcha_key, { action: 'submit' }).then(function (token) { 46 // Add hidden input if missing 47 if ($('#recaptchaResponse').length === 0) { 48 $form.append('<input type="hidden" name="g-recaptcha-response" id="recaptchaResponse">'); 49 } 50 $('#recaptchaResponse').val(token); 51 52 // Submit form normally 53 $form.addClass('skip-grecaptcha'); 54 //$form.submit(); 55 HTMLFormElement.prototype.submit.call(form); 56 57 return true; 58 }); 59 }); 60 61 // if grecaptcha execute fail, just submit the form 62 // console.log('recaptcha execute failed'); 63 // $form.addClass('skip-grecaptcha'); 64 // HTMLFormElement.prototype.submit.call($form); 65 } else { 66 $form.addClass('skip-grecaptcha'); 67 HTMLFormElement.prototype.submit.call(form); 68 } 69 70 // debugging 71 /*e.preventDefault(); 72 let $form = $(this); 73 $form.addClass('skip-grecaptcha'); 74 //$(this).submit(); 75 HTMLFormElement.prototype.submit.call(this);*/ 76 } 77 ); 78 79 }); 80}
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.