1/** 2 * Start contact form widget script 3 */ 4 5(function ($, elementor) { 6 7 'use strict'; 8 9 var PenciContactForm = function ($scope, $) { 10 11 var $contactForm = $scope.find('.pencif-contact-form .without-recaptcha'); 12 13 if (!$contactForm.length) { 14 return; 15 } 16 17 $contactForm.submit(function (e) { 18 sendContactForm($contactForm); 19 return false; 20 }); 21 22 return false; 23 24 }; 25 26 function sendContactForm($contactForm) { 27 28 $.ajax({ 29 url: $contactForm.attr('action'), 30 type: 'POST', 31 data: $contactForm.serialize(), 32 beforeSend: function () { 33 $contactForm.addClass('loading'); 34 }, 35 success: function (data) { 36 var redirectURL = $(data).data('redirect'), 37 isExternal = $(data).data('external'), 38 resetStatus = $(data).data('resetstatus'); 39 40 41 $contactForm.append(data); 42 43 44 if (redirectURL) { 45 if (redirectURL != 'no') { 46 window.open(redirectURL, isExternal); 47 } 48 } 49 50 if (resetStatus) { 51 if (resetStatus !== 'no') { 52 $contactForm[0].reset(); 53 } 54 } 55 56 $contactForm.removeClass('loading'); 57 } 58 }); 59 return false; 60 } 61 62 // google invisible captcha 63 function PenciCFormCheckGIC() { 64 65 return new Promise(function (resolve, reject) { 66 67 if (grecaptcha === undefined) { 68 reject(); 69 } 70 71 var response = grecaptcha.getResponse(); 72 73 if (!response) { 74 reject(); 75 } 76 77 var $contactForm = $('.g-recaptcha-response').filter(function () { 78 return $(this).val() === response; 79 }).closest('form.pencif-contact-form'); 80 81 var contactFormAction = $contactForm.attr('action'); 82 83 if (contactFormAction && contactFormAction !== '') { 84 sendContactForm($contactForm); 85 } 86 87 grecaptcha.reset(); 88 89 }); //end promise 90 91 } 92 93 //Contact form recaptcha callback, if needed 94 window.PenciCFormCheckGICF = PenciCFormCheckGIC; 95 96 jQuery(window).on('elementor/frontend/init', function () { 97 elementorFrontend.hooks.addAction('frontend/element_ready/penci-contact-form.default', PenciContactForm); 98 }); 99 100 101}(jQuery, window.elementorFrontend)); 102 103/** 104 * End contact form widget script 105 */
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.