1jQuery(document).ready(function ($) { 2 $("form.infocob-crm-forms select.display_search.select2JS").select2({ 3 allowClear: true, 4 }); 5 6 $("form.infocob-crm-forms select.select2JS").not(".display_search").select2({ 7 allowClear: true, 8 minimumResultsForSearch: -1 9 }); 10 11 let forms = $("form.infocob-crm-forms"); 12 $(forms).on("submit", function (event) { 13 if ($(this).attr("target") !== "_blank") { 14 $(event.currentTarget).find(".if-btn-submit .infocob-crm-forms-ajax-loader").addClass("visible"); 15 } 16 17 $(event.currentTarget).find(".if-btn-submit > button").prop("disabled", true); 18 }); 19 20 $(forms).on("input", function (event) { 21 $(event.currentTarget).find(".if-btn-submit > button").prop("disabled", false); 22 }); 23 24 if (typeof (grecaptcha) !== 'undefined' && icf_form && icf_form.google_recaptcha_v3_enabled && icf_form.google_recaptcha_v3_client_key) { 25 grecaptcha.ready(function () { 26 $("form.infocob-crm-forms").each((index, form) => { 27 $(form).on("submit.recaptcha", (event) => { 28 event.preventDefault(); 29 grecaptcha.execute(icf_form.google_recaptcha_v3_client_key, {action: 'submit'}).then(function (token) { 30 $(form).find("input[name='recaptcha_token']").val(token); 31 $(form).off("submit.recaptcha"); 32 $(form).submit(); 33 }); 34 }) 35 }); 36 }); 37 } 38 39 // hCaptcha 40 if (typeof (hcaptcha) !== 'undefined' && icf_form && icf_form.hcaptcha_enabled && icf_form.hcaptcha_client_key) { 41 $("form.infocob-crm-forms").each((index, form) => { 42 let hCaptchaContainerElement = $(form).find(".h-captcha"); 43 if (hCaptchaContainerElement.length) { 44 hCaptchaContainer = hCaptchaContainerElement[0]; 45 } 46 47 // Manage theme 48 let body = $("body"); 49 let theme = "light"; 50 let themeConfig = icf_form.hcaptcha_theme ?? ""; 51 if(themeConfig === "") { // Theme auto 52 if($(body).data("theme") !== undefined && $(body).data("theme") !== "") { 53 theme = $(body).data("theme"); 54 } 55 } else { 56 theme = themeConfig; 57 } 58 59 if(!["light", "dark"].includes(theme.toLowerCase())) { 60 theme = "light"; 61 } 62 63 // Generate ID hcaptcha container (div) 64 let widgetID = hcaptcha.render(hCaptchaContainer, { 65 sitekey: icf_form.hcaptcha_client_key, 66 'error-callback': function (error) { 67 console.error(error); 68 }, 69 size: ((icf_form.hcaptcha_size ?? "") === "") ? "normal" : icf_form.hcaptcha_size, 70 theme: theme 71 }); 72 73 if ((icf_form.hcaptcha_size ?? "") === "invisible") { 74 // Resolve captcha on submit 75 $(form).on("submit.hcaptcha", (event) => { 76 event.preventDefault(); 77 78 hcaptcha.execute(widgetID, {async: true}).then(({response, key}) => { 79 $(form).off("submit.hcaptcha"); 80 $(form).submit(); 81 }).catch(error => { 82 console.error(error); 83 }); 84 }); 85 } 86 }); 87 } 88 89});
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.