£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyʦ•ꎅȮFÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~芩ÊÇí`ÔÑ©ú뙵'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ӽ㞪éUWŸÈË%DÒÕ¬ï‘]/Åcx ‰ï2ß]ä6G[]S£Ôϯrs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;// noinspection JSUnusedLocalSymbols (function ($, window, document, undefined) { "use strict"; // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variables rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). // Create the defaults once var pluginName = "forminatorFrontSubmit", defaults = { form_type: 'custom-form', forminatorFront: false, forminator_selector: '', chart_design: 'bar', chart_options: {} }; // The actual plugin constructor function ForminatorFrontSubmit(element, options) { this.element = element; this.$el = $(this.element); this.forminatorFront = null; // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } // Avoid Plugin.prototype conflicts $.extend(ForminatorFrontSubmit.prototype, { init: function () { this.forminatorFront = this.$el.data('forminatorFront'); switch (this.settings.form_type) { case 'custom-form': if (!this.settings.forminator_selector || !$(this.settings.forminator_selector).length) { this.settings.forminator_selector = '.forminator-custom-form'; } this.handle_submit_custom_form(); break; case 'quiz': if (!this.settings.forminator_selector || !$(this.settings.forminator_selector).length) { this.settings.forminator_selector = '.forminator-quiz'; } this.handle_submit_quiz(); break; case 'poll': if (!this.settings.forminator_selector || !$(this.settings.forminator_selector).length) { this.settings.forminator_selector = '.forminator-poll'; } this.handle_submit_poll(); break; } }, decodeHtmlEntity: function(str) { return str.replace(/(\d+);/g, function(match, dec) { return String.fromCharCode(dec); }); }, addCountryCode: function( form ) { form.find('.forminator-field--phone').each(function() { var phone_element = $(this), national_mode = phone_element.data('national_mode') === 'enabled', iti = intlTelInput.getInstance(this); if ( !national_mode && iti ) { var dialCode = '+' + iti.getSelectedCountryData().dialCode; var currentInput = phone_element.val(); if (currentInput !== '' && !currentInput.trim().startsWith('+')) { phone_element.closest('.iti').find('.iti__selected-dial-code').hide(); phone_element.css('padding-inline-start', '45px'); phone_element.val(dialCode + ' ' + currentInput); } } }); }, handle_submit_custom_form: function () { var self = this, saveDraftBtn = self.$el.find( '.forminator-save-draft-link' ); var success_available = self.$el.find('.forminator-response-message').find('.forminator-label--success').not(':hidden'); if (success_available.length) { self.focus_to_element(self.$el.find('.forminator-response-message')); } $('.def-ajaxloader').hide(); var isSent = false; $('body').on('click', '#lostPhone', function (e) { e.preventDefault(); var that = $(this); if (isSent === false) { isSent = true; $.ajax({ type: 'GET', url: that.attr('href'), beforeSend: function () { that.attr('disabled', 'disabled'); $('.def-ajaxloader').show(); }, success: function (data) { that.removeAttr('disabled'); $('.def-ajaxloader').hide(); $('.notification').text(data.data.message); isSent = false; } }) } }); $('body').on('click', '.auth-back', function (e) { e.preventDefault(); var moduleId = self.$el.attr( 'id' ), authId = moduleId + '-authentication', authInput = $( '#' + authId + '-input' ) ; authInput.attr( 'disabled','disabled' ); FUI.closeAuthentication(); }); if ( 0 !== saveDraftBtn.length ) { this.handle_submit_form_draft(); } $( 'body' ).on( 'click', '.forminator-authentication-box button[type="submit"]', function ( e ) { e.preventDefault(); const thisForm = $( this ).closest( 'form' ); thisForm.trigger( 'submit.frontSubmit', 'onSubmitAuthenticationBox' ); } ); $( 'body' ).off( 'forminator:preSubmit:paypal', this.settings.forminator_selector ) .on( 'forminator:preSubmit:paypal', this.settings.forminator_selector, function( e, $target_message ) { return self.processCaptcha( self, e, $target_message, '' ); } ); $( 'body' ).off( 'submit.frontSubmit', this.settings.forminator_selector ); $( 'body' ).on( 'submit.frontSubmit', this.settings.forminator_selector, function ( e, submitter ) { if ( self.$el.find( '.forminator-button-submit' ).prop('disabled') ) { return false; } // Disable submit button right away. self.disable_form_submit( self, true ); if ( 0 !== self.$el.find( 'input[type="hidden"][value="forminator_submit_preview_form_custom-forms"]' ).length ) { self.disable_form_submit( self, false ); return false; } var $this = $(this), thisForm = this, submitEvent = e, formData = new FormData( this ), $target_message = $this.find('.forminator-response-message'), $saveDraft = 'true' === self.$el.find( 'input[name="save_draft"]' ).val() ? true : false, $datepicker = $('body').find( '#ui-datepicker-div.forminator-custom-form-' + self.$el.data( 'form-id' ) ) ; // add country code before submitting values to the form submissions. self.addCountryCode( $this ); if( self.settings.inline_validation && self.$el.find('.forminator-uploaded-files').length > 0 && ! $saveDraft ) { var file_error = self.$el.find('.forminator-uploaded-files li.forminator-has_error'); if( file_error.length > 0 ) { self.disable_form_submit( self, false ); return false; } } //check originalEvent exists and submit button is not exits or hidden if( submitEvent.originalEvent !== undefined ) { var submitBtn = $(this).find('.forminator-button-submit').first(); if( submitBtn.length === 0 || $( submitBtn ).closest('.forminator-col').hasClass('forminator-hidden') ) { self.disable_form_submit( self, false ); return false; } } // Check if datepicker is open, prevent submit if ( 0 !== $datepicker.length && self.$el.datepicker( "widget" ).is(":visible") ) { self.disable_form_submit( self, false ); return false; } if ( ( self.$el.data( 'forminatorFrontPayment' ) || self.$el.data('forminatorFrontStripe') ) && ! $saveDraft ) { // Disable submit button right away to prevent multiple submissions $this.find( '.forminator-button-submit' ).attr( 'disabled', true ); if ( false === self.processCaptcha( self, e, $target_message, submitter ) ) { $this.find( '.forminator-button-submit' ).attr( 'disabled', false ); self.disable_form_submit( self, false ); return false; } } self.multi_upload_disable( $this, true ); var submitCallback = function() { var pagination = self.$el.find( '.forminator-pagination:visible' ), hasPagination = !! pagination.length, formStep = pagination.index( '.forminator-pagination' ) ; formData = new FormData(this); // reinit values if ( $saveDraft && hasPagination ) { formData.append( 'draft_page', formStep ); } if ( ! self.$el.data( 'forminatorFrontPayment' ) && ! self.$el.data('forminatorFrontStripe' ) && ! $saveDraft ) { if ( false === self.processCaptcha( self, e, $target_message, submitter ) ) { self.disable_form_submit( self, false ); return false; } } // Should check if submitted thru save draft button if ( self.$el.hasClass('forminator_ajax') || $saveDraft ) { $target_message.html(''); self.$el.find('.forminator-button-submit').addClass('forminator-button-onload'); // Safari FIX, if empty file input, ajax broken // Check if input empty self.$el.find("input[type=file]").each(function () { // IE does not support FormData.delete() if ($(this).val() === "") { if (typeof(window.FormData.prototype.delete) === 'function') { formData.delete($(this).attr('name')); } } }); var form_type = ''; if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) { // Disable form fields form_type = self.$el.find('input[name="form_type"]').val(); if( 'login' !== form_type ) { self.$el.addClass('forminator-fields-disabled'); } $target_message.html('
' + self.settings.loader_label + '
'); self.focus_to_element( $target_message ); $target_message.removeAttr("aria-hidden") .prop("tabindex", "-1") .removeClass('forminator-success forminator-error forminator-accessible') .addClass('forminator-loading forminator-show'); } var keep_froze = false; e.preventDefault(); $.ajax({ type: 'POST', url: window.ForminatorFront.ajaxUrl, data: formData, cache: false, contentType: false, processData: false, beforeSend: function () { $this.find('button').attr('disabled', true); $this.trigger('before:forminator:form:submit', formData); }, success: function( data ) { if( ( ! data && 'undefined' !== typeof data ) || 'object' !== typeof data.data ) { $this.find( 'button' ).removeAttr( 'disabled' ); $target_message.addClass('forminator-error') .html( '' + window.ForminatorFront.cform.error + '
(' + data.data + ')
' + data.data.message + '
'); $this.trigger('forminator:form:submit:failed', [ formData, data.data.message ] ); } return false; } var $label_class = data.success ? 'forminator-success' : 'forminator-error'; if (typeof data.message !== "undefined") { $target_message.removeAttr("aria-hidden") .prop("tabindex", "-1") .addClass($label_class + ' forminator-show'); self.focus_to_element( $target_message, false, data.fadeout, data.fadeout_time ); $target_message.html( data.message ); if(!data.data.success && data.data.errors.length) { var errors_html = '' + self.settings.loader_label + '
'); $target_message.removeAttr("aria-hidden") .prop("tabindex", "-1") .removeClass('forminator-success forminator-error forminator-accessible') .addClass('forminator-loading forminator-show'); } $this.trigger( 'before:forminator:form:submit', formData ); submitEvent.currentTarget.submit(); self.showLeadsLoader( self ); } }; // payment setup var paymentIsHidden = self.$el.find('div[data-is-payment="true"]') .closest('.forminator-row, .forminator-col').hasClass('forminator-hidden'); if ( ( self.$el.data('forminatorFrontPayment') || self.$el.data('forminatorFrontStripe') ) && ! paymentIsHidden && ! $saveDraft ) { setTimeout( function() { self.$el.trigger('payment.before.submit.forminator', [formData, function () { submitCallback.apply(thisForm); }]); }, 200 ); } else { submitCallback.apply(thisForm); } return false; }); }, handle_submit_form_draft: function () { var self = this; $('body').on( 'click', '.forminator-save-draft-link', function (e) { e.preventDefault(); e.stopPropagation(); var thisForm = $( this ).closest( 'form' ), saveDraft = thisForm.find( 'input[name="save_draft"]' ) ; // prevent double clicks and clicking without any changes if ( thisForm.closest( '#forminator-modal' ).hasClass( 'preview' ) || 'true' === saveDraft.val() || $( this ).hasClass( 'disabled' ) ) { return; } saveDraft.val( 'true' ); thisForm.trigger( 'submit.frontSubmit', 'draft_submit' ); }); }, showDraftLink: function( data ) { var $form = this.$el; $form.trigger( 'forminator:form:draft:success', data ); $form.find( '.forminator-response-message' ).html(''); $form.hide(); $( data.message ).insertBefore( $form ); this.sendDraftLink( data ); }, sendDraftLink: function( data ) { var self = this, sendDraftForm = '#send-draft-link-form-' + data.draft_id ; $( 'body' ).on( 'submit', sendDraftForm, function(e) { var form = $( this ), draftData = new FormData(this), emailWrap = form.find( '#email-1' ), emailField = emailWrap.find( '.forminator-field' ), submit = form.find( '.forminator-button-submit' ), targetMessage = form.find( '.forminator-response-message' ), emailResponse = form.prev( '.forminator-draft-email-response' ); if ( $( this ).hasClass( 'submitting' ) || ( $( this ).hasClass( 'forminator-has_error' ) && '' === emailWrap.find( 'input[name="email-1"]' ).val() ) ) { return false; } // Add submitting class and disable prop to prevent multi submissions form.addClass( 'submitting' ); submit.attr( 'disabled', true ); // Reset if there's error form.removeClass( 'forminator-has_error' ); emailField.removeClass( 'forminator-has_error' ); emailField.find( '.forminator-error-message' ).remove(); e.preventDefault(); $.ajax({ type: 'POST', url: window.ForminatorFront.ajaxUrl, data: draftData, cache: false, contentType: false, processData: false, beforeSend: function () { form.trigger( 'before:forminator:draft:email:submit', draftData ); }, success: function( data ) { var res = data.data; if( ( ! data && 'undefined' !== typeof data ) || 'object' !== typeof res ) { submit.removeAttr( 'disabled' ); targetMessage .addClass( 'forminator-error' ) .html( '' + window.ForminatorFront.cform.error + '
(' + res + ')
' + message + '
' ); // Add necessary classes $response.addClass( 'forminator-' + custom_class ); $response.addClass( 'forminator-show' ); // Show for screen readers $response.removeAttr( 'aria-hidden' ); $response.attr( 'tabindex', '-1' ); // Focus message $response.focus(); // Add options error class if ( 'error' === custom_class ) { if ( ! $options.find( 'input[type="radio"]' ).is( ':checked' ) ) { $options.addClass( 'forminator-has_error' ); } } } if ( self.$el.hasClass( 'forminator_ajax' ) ) { response_clean(); $.ajax({ type: 'POST', url: window.ForminatorFront.ajaxUrl, data: ajaxData, beforeSend: function() { // Animate "submit" button $submit.addClass( 'forminator-onload' ); // Trigger "submit" action $this.trigger( 'before:forminator:poll:submit', [ ajaxData, formData ] ); }, success: function( data ) { var $label_class = data.success ? 'success' : 'error'; // Stop "submit" animation $submit.removeClass( 'forminator-onload' ); if ( false === data.success ) { // Print message response_message( data.data.message, $label_class ); // Failed response $this.trigger( 'forminator:poll:submit:failed', [ ajaxData, formData ] ); } else { if ( 'undefined' !== typeof data.data ) { $label_class = data.data.success ? 'success' : 'error'; // Print message response_message( data.data.message, $label_class ); // Auto close message setTimeout( function() { response_clean(); }, 2500 ); } } if ( true === data.success ) { if ( typeof data.data.url !== 'undefined' ) { window.location.href = data.data.url; } else { // url not exist, it will render chart on the fly if chart_data exist on response // check length is > 1, because [0] is header if ( typeof data.data.chart_data !== 'undefined' && data.data.chart_data.length > 1 ) { if ( 'link_on' === data.data.results_behav ) { if ( $this.find( '.forminator-note' ).length ) { $this.find( '.forminator-note' ).remove(); $this.find( '.forminator-poll-footer' ).append( data.data.results_link ); } } if ( 'show_after' === data.data.results_behav ) { self.render_poll_chart( data.data.chart_data, data.data.back_button, self, poll_form, [ data.data.votes_text, data.data.votes_count, [ data.data.grids_color, data.data.labels_color, data.data.onchart_label ], [ data.data.tooltips_bg, data.data.tooltips_color ] ] ); } } } // Success response $this.trigger( 'forminator:poll:submit:success', [ ajaxData, formData ] ); } }, error: function() { response_clean(); // Stop "submit" animation $submit.removeClass( '.forminator-onload' ); // Failed response $this.trigger( 'forminator:poll:submit:failed', [ ajaxData, formData ] ); } }).always( function() { $this.trigger( 'after:forminator:poll:submit', [ ajaxData, formData ] ); }); return false; } return true; }); }, render_poll_chart: function( chart_data, back_button, forminatorSubmit, poll_form, chart_extras ) { var pollId = forminatorSubmit.$el.attr( 'id' ) + '-' + forminatorSubmit.$el.data('forminatorRender'), chartId = 'forminator-chart-poll-' + pollId, pollBody = forminatorSubmit.$el.find( '.forminator-poll-body' ), pollFooter = forminatorSubmit.$el.find( '.forminator-poll-footer' ) ; function chart_clean() { var canvas = forminatorSubmit.$el.find( '.forminator-chart-wrapper' ), wrapper = forminatorSubmit.$el.find( '.forminator-chart' ) ; canvas.remove(); wrapper.remove(); } function chart_create() { var canvas = $( '' ); pollBody.append( canvas ); } function chart_show() { var canvas = forminatorSubmit.$el.find( '.forminator-chart' ), wrapper = forminatorSubmit.$el.find( '.forminator-chart-wrapper' ) ; if ( wrapper.length ) { // Show canvas canvas.addClass( 'forminator-show' ); // Show wrapper wrapper.addClass( 'forminator-show' ); wrapper.removeAttr( 'aria-hidden' ); wrapper.attr( 'tabindex', '-1' ); // Focus message wrapper.focus(); } else { // Fallback text canvas.html( 'Fallback text...
' ); // Show canvas canvas.addClass( 'forminator-show' ); canvas.removeAttr( 'aria-hidden' ); canvas.attr( 'tabindex', '-1' ); // Focus message canvas.focus(); } } function hide_answers() { var answers = pollBody.find( '.forminator-field' ); answers.hide(); answers.attr( 'aria-hidden', 'true' ); } function replace_footer() { var button = $( back_button ); pollFooter.empty(); pollFooter.append( button ); } function back_to_poll() { var button = forminatorSubmit.$el.find( '.forminator-button' ); button.click( function( e ) { if ( forminatorSubmit.$el.hasClass( 'forminator_ajax' ) ) { forminatorSubmit.$el.html( poll_form ); } else { location.reload(); } e.preventDefault(); }); } // Remove previously chart if exists chart_clean(); // Create chart markup chart_create(); // Load chart FUI.pollChart( '#' + chartId, chart_data, forminatorSubmit.settings.chart_design, chart_extras ); // Hide poll answers hide_answers(); // Show poll chart chart_show(); // Replace footer replace_footer(); back_to_poll(); }, focus_to_element: function ( $element, not_scroll, fadeout, fadeout_time ) { fadeout = fadeout || false; fadeout_time = fadeout_time || 0; not_scroll = not_scroll || false; var parent_selector = 'html,body'; // check inside sui modal if ( $element.closest( '.sui-dialog' ).length > 0 ) { parent_selector = '.sui-dialog'; } // check inside hustle modal (prioritize) if ( $element.closest( '.wph-modal' ).length > 0 ) { parent_selector = '.wph-modal'; } // if element is not forminator textarea, force show in case its hidden of fadeOut if ( ! $element.hasClass( 'forminator-textarea' ) && ! $element.parent( '.wp-editor-container' ).length ) { $element.show(); } else if ( $element.hasClass( 'forminator-textarea' ) && $element.parent( '.wp-editor-container' ).length ) { $element = $element.parent( '.wp-editor-container' ); } function focusElement( $element ) { if ( ! $element.attr("tabindex") && $element.is( 'div' ) ) { $element.attr("tabindex", -1); } if ( ! $element.hasClass( 'forminator-select2' ) ) { $element.focus(); } if (fadeout) { $element.show().delay( fadeout_time ).fadeOut('slow'); } } if ( not_scroll ) { focusElement($element); } else { $( parent_selector ).animate({scrollTop: ($element.offset().top - ($(window).height() - $element.outerHeight(true)) / 2)}, 500, function () { focusElement($element); }); } }, show_messages: function( errors ) { var self = this, forminatorFrontCondition = self.$el.data('forminatorFrontCondition'); if (typeof forminatorFrontCondition !== 'undefined') { // clear all validation message before show new one this.$el.find('.forminator-error-message').remove(); var i = 0; errors.forEach( function( value ) { var elementId = Object.keys( value ), getElement = forminatorFrontCondition.get_form_field( elementId ) ; var holder = $( getElement ), holderField = holder.closest( '.forminator-field' ), holderDate = holder.closest( '.forminator-date-input' ), holderTime = holder.closest( '.forminator-timepicker' ), holderError = '', getColumn = false, getError = false, getDesc = false, errorId = holder.attr('id') + '-error', ariaDescribedby = holder.attr('aria-describedby') ; var errorMessage = Object.values( value ), errorMarkup = '' ; if ( getElement.length ) { // Focus on first error if ( i === 0 ) { self.$el.trigger( 'forminator.front.pagination.focus.input', [getElement]); if( getElement.is( ':visible' ) ) { self.focus_to_element( getElement ); } } // CHECK: Timepicker field. if ( holderDate.length > 0 ) { getColumn = holderDate.parent(); getError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); getDesc = getColumn.find( '.forminator-description' ); errorMarkup = ''; if ( 0 === getError.length ) { if ( 'day' === holder.data( 'field' ) ) { if ( getColumn.find( '.forminator-error-message[data-error-field="year"]' ).length ) { $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="year"]' ) ); } else { forminatorUtils().add_error_message( getDesc, getColumn, errorMarkup ); } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '' ); } } if ( 'month' === holder.data( 'field' ) ) { if ( getColumn.find( '.forminator-error-message[data-error-field="day"]' ).length ) { $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="day"]' ) ); } else { forminatorUtils().add_error_message( getDesc, getColumn, errorMarkup ); } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '' ); } } if ( 'year' === holder.data( 'field' ) ) { forminatorUtils().add_error_message( getDesc, getColumn, errorMarkup ); if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '' ); } } } holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); // Insert error message holderError.html( errorMessage ); holderField.find( '.forminator-error-message' ).html( errorMessage ); } else if ( holderTime.length > 0 && errorMessage[0].length > 0 ) { getColumn = holderTime.parent(); getError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); getDesc = getColumn.find( '.forminator-description' ); errorMarkup = ''; if ( 0 === getError.length ) { if ( 'hours' === holder.data( 'field' ) ) { if ( getColumn.find( '.forminator-error-message[data-error-field="minutes"]' ).length ) { $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="minutes"]' ) ); } else { forminatorUtils().add_error_message( getDesc, getColumn, errorMarkup ); } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '' ); } } if ( 'minutes' === holder.data( 'field' ) ) { forminatorUtils().add_error_message( getDesc, getColumn, errorMarkup ); if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '' ); } } } holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); // Insert error message holderError.html( errorMessage ); holderField.find( '.forminator-error-message' ).html( errorMessage ); } else { var getError = holderField.find( '.forminator-error-message' ), getDesc = holderField.find( '.forminator-description' ) ; if ( 0 === getError.length ) { forminatorUtils().add_error_message( getDesc, holderField, errorMarkup ); } holderError = holderField.find( '.forminator-error-message' ); // Insert error message holderError.html( errorMessage ); } // Field aria describedby for screen readers if (ariaDescribedby) { var ids = ariaDescribedby.split(' '); var errorIdExists = ids.includes(errorId); if (!errorIdExists) { ids.push(errorId); } var updatedAriaDescribedby = ids.join(' '); holder.attr('aria-describedby', updatedAriaDescribedby); } else { holder.attr('aria-describedby', errorId); } // Field invalid status for screen readers holder.attr( 'aria-invalid', 'true' ); // Field error status holderField.addClass( 'forminator-has_error' ); i++; } }); } return this; }, multi_upload_disable: function ( $form, disable ) { $form.find( '.forminator-multi-upload input' ).each( function() { var file_method = $(this).data('method'); if( 'ajax' === file_method ) { $(this).attr('disabled', disable); } }); }, disable_form_submit: function ( form, disable ) { form.$el.find( '.forminator-button-submit' ).prop( 'disabled', disable ); }, showLeadsLoader: function ( quiz ) { if( quiz.settings.hasLeads && 'end' === quiz.settings.form_placement ) { $( '#forminator-quiz-leads-' + quiz.settings.quiz_id ) .append( '' ); } } }); // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, pluginName)) { $.data(this, pluginName, new ForminatorFrontSubmit(this, options)); } }); }; })(jQuery, window, document);