1(function ($) { 2 'use strict'; 3 4 window.houzezValidateElementor = function (form) { 5 if ($.fn.validate && $.fn.ajaxSubmit) { 6 var $form = $(form), 7 submitButton = $form.find('.houzez-submit-button'), 8 messageContainer = $form.find('.ele-form-messages'), 9 errorContainer = $form.find('.error-container'), 10 ajaxLoader = $form.find('.houzez-loader-js'), 11 formOptions = { 12 beforeSubmit: function () { 13 ajaxLoader.addClass('loader-show'); 14 submitButton.attr('disabled', 'disabled'); 15 messageContainer.fadeOut('fast'); 16 errorContainer.fadeOut('fast'); 17 }, 18 success: function (response, statusText, xhr, $form) { 19 response = $.parseJSON(response); 20 ajaxLoader.removeClass('loader-show'); 21 submitButton.removeAttr('disabled'); 22 23 if (response.success) { 24 $form.resetForm(); 25 messageContainer 26 .html( 27 '<div class="alert alert-success alert-dismissible fade show" role="alert">' + 28 '<i class="houzez-icon icon-check-circle-1 me-1"></i> ' + 29 response.msg + 30 '</div>' 31 ) 32 .fadeIn('fast'); 33 34 if (houzez_vars.houzez_reCaptcha == 1) { 35 $form.find('.g-recaptcha-response').remove(); 36 if (houzez_vars.g_recaptha_version == 'v3') { 37 houzezReCaptchaLoad(); 38 } else { 39 houzezReCaptchaReset(); 40 } 41 } else if ($form.find('.houzez-turnstile').length > 0) { 42 if (typeof houzezTurnstileReset === 'function') { 43 houzezTurnstileReset(); 44 } else if (typeof turnstile !== 'undefined') { 45 $form.find('.houzez-turnstile').each(function() { 46 turnstile.reset(this); 47 }); 48 } 49 } 50 51 if (response.redirect_to != '') { 52 setTimeout(function () { 53 window.location.replace( 54 response.redirect_to 55 ); 56 }, 500); 57 } 58 } else { 59 messageContainer 60 .html( 61 '<div class="alert alert-danger alert-dismissible fade show" role="alert">' + 62 '<i class="houzez-icon icon-remove-circle me-1"></i> ' + 63 response.msg + 64 '</div>' 65 ) 66 .fadeIn('fast'); 67 } 68 }, 69 }; 70 71 $form.validate({ 72 highlight: function (element, errorClass, validClass) { 73 $(element).addClass('is-invalid').removeClass('is-valid'); 74 75 // For checkboxes, also add/remove class for control__indicator 76 if ( 77 $(element).is(':checkbox') && 78 $(element).closest('.control--checkbox').length 79 ) { 80 $(element) 81 .closest('.control--checkbox') 82 .find('.control__indicator') 83 .addClass('is-invalid') 84 .removeClass('is-valid'); 85 } 86 }, 87 unhighlight: function (element, errorClass, validClass) { 88 $(element).removeClass('is-invalid').addClass('is-valid'); 89 90 // For checkboxes, also add/remove class for c
90ontrol__indicator 91 if ( 92 $(element).is(':checkbox') && 93 $(element).closest('.control--checkbox').length 94 ) { 95 $(element) 96 .closest('.control--checkbox') 97 .find('.control__indicator') 98 .removeClass('is-invalid') 99 .addClass('is-valid'); 100 } 101 }, 102 errorPlacement: function (error, element) { 103 // Do nothing with the error, effectively hiding it 104 return true; 105 }, 106 submitHandler: function (form) { 107 $(form).ajaxSubmit(formOptions); 108 }, 109 }); 110 } // end if jQuery.validate 111 }; // end houzezValidateElementor 112 113 // Initialize the validation when the document is ready 114 $(document).ready(function () { 115 $('.houzez-ele-form-js').each(function () { 116 houzezValidateElementor(this); 117 }); 118 }); 119 120 // Re-initialize the validation when an Elementor popup is opened 121 $(document).on('elementor/popup/show', function () { 122 $('.houzez-ele-form-js').each(function () { 123 houzezValidateElementor(this); 124 }); 125 }); 126})(jQuery);
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.