£Á°è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áyMä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 = "forminatorFrontPagination", defaults = { totalSteps: 0, step: 0, hashStep: 0, inline_validation: false }; // The actual plugin constructor function ForminatorFrontPagination(element, options) { this.element = $(element); this.$el = this.element; this.totalSteps = 0; this.step = 0; this.finished = false; this.hashStep = false; this.next_button_txt = ''; this.prev_button_txt = ''; this.custom_label = []; this.form_id = 0; this.element = ''; // 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(ForminatorFrontPagination.prototype, { init: function () { var self = this; var draftPage = !! this.$el.data( 'draft-page' ) ? this.$el.data( 'draft-page' ) : 0; this.next_button = this.settings.next_button ? this.settings.next_button : window.ForminatorFront.cform.pagination_next; this.prev_button = this.settings.prev_button ? this.settings.prev_button : window.ForminatorFront.cform.pagination_prev; if (this.$el.find('input[name=form_id]').length > 0) { this.form_id = this.$el.find('input[name=form_id]').val(); } this.totalSteps = this.settings.totalSteps; this.step = this.settings.step; this.quiz = this.settings.quiz; this.element = this.$el.find('[data-step=' + this.step + ']').data('name'); if (this.form_id && typeof window.Forminator_Cform_Paginations === 'object' && typeof window.Forminator_Cform_Paginations[this.form_id] === 'object') { this.custom_label = window.Forminator_Cform_Paginations[this.form_id]; } if ( draftPage > 0 ) { this.go_to( draftPage, true ); } else if (this.settings.hashStep && this.step > 0) { this.go_to(this.step, true); } else if ( this.quiz ) { this.go_to(0, true); } else { this.go_to(0, false); } this.render_navigation(); this.render_bar_navigation(); this.render_footer_navigation( this.form_id ); this.init_events(); this.update_navigation(); this.$el.find('.forminator-button.forminator-button-back, .forminator-button.forminator-button-next, .forminator-button.forminator-button-submit').on("click", function (e) { e.preventDefault(); $(this).trigger('forminator.front.pagination.move'); self.resetRichTextEditorHeight(); }); // Update progress bar percentage on form submit. this.$el.on('before:forminator:form:submit', function( e, formData ) { if( formData.get( 'save_draft' ) !== 'true' ) { self.update_progress_bar_percentage( 100 ); } }); this.$el.on('click', '.forminator-result--view-answers', function(e){ e.preventDefault(); $(this).trigger('forminator.front.pagination.move'); }); this.update_buttons(); }, init_events: function () { var self = this; this.$el.find('.forminator-button-back').on('forminator.front.pagination.move',function (e) { self.handle_click('prev'); }); this.$el.on('forminator.front.pagination.move', '.forminator-result--view-answers', function (e) { self.handle_click('prev'); }); this.$el.find('.forminator-button-next').on('forminator.front.pagination.move', function (e) { self.handle_click('next'); }); this.$el.find('.forminator-step').on("click", function (e) { e.preventDefault(); var step = $(this).data('nav'); self.handle_step(step); }); this.$el.on('reset', function (e) { self.on_form_reset(e); }); this.$el.on('forminator:quiz:submit:success', function (e, ajaxData, formData, resultText) { if ( resultText ) { self.move_to_results(e); } }); this.$el.on('forminator.front.pagination.focus.input', function (e, input) { self.on_focus_input(e, input); }); }, /** * Move quiz to rezult page */ move_to_results: function (e) { this.finished = true; if ( this.$el.find('.forminator-submit-rightaway').length ) { this.$el.find('#forminator-submit').removeClass('forminator-hidden'); } else { this.handle_click('next'); } }, /** * On reset event of Form * * @since 1.0.3 * * @param e */ on_form_reset: function (e) { // Trigger pagination to first page this.go_to(0, true); this.update_buttons(); }, /** * On Input focused * * @param e * @param input */ on_focus_input: function (e, input) { //Go to page where element exist var step = this.get_page_of_input(input); this.go_to(step, true); this.update_buttons(); }, render_footer_navigation: function( form_id ) { var footer_html = '', paypal_field = '', footer_align = ( this.custom_label['has-paypal'] === true ) ? ' style="align-items: flex-start;"' : '', save_draft_btn = this.$el.find( '.forminator-save-draft-link' ).length ? this.$el.find( '.forminator-save-draft-link' ) : '' ; if ( this.custom_label[ this.element ] && this.custom_label[ 'pagination-labels' ] === 'custom' ){ this.prev_button_txt = this.custom_label[ this.element ][ 'prev-text' ] !== '' ? this.custom_label[ this.element ][ 'prev-text' ] : this.prev_button; this.next_button_txt = this.custom_label[ this.element ][ 'next-text' ] !== '' ? this.custom_label[ this.element ][ 'next-text' ] : this.next_button; } else { this.prev_button_txt = this.prev_button; this.next_button_txt = this.next_button; } if ( this.$el.hasClass('forminator-design--material') ) { footer_html = '