core/skin/p006.yurecnt.ru/plugins/smart-wizard/js/jquery.smartWizard.min.js

12 lines
13 KiB
JavaScript
Raw Normal View History

2022-12-17 18:15:09 +05:00
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,s){return e&&_defineProperties(t.prototype,e),s&&_defineProperties(t,s),t}
/*!
* jQuery SmartWizard v5.0.0
* The awesome jQuery step wizard plugin
* http://www.techlaboratory.net/jquery-smartwizard
*
* Created by Dipu Raj
* http://dipu.me
*
* @license Licensed under the terms of the MIT License
* https://github.com/techlab/jquery-smartwizard/blob/master/LICENSE
*/!function(v,i,t){var n={selected:0,theme:"default",justified:!0,autoAdjustHeight:!0,cycleSteps:!1,backButtonSupport:!0,enableURLhash:!0,transition:{animation:"none",speed:"400",easing:""},toolbarSettings:{toolbarPosition:"bottom",toolbarButtonPosition:"right",showNextButton:!0,showPreviousButton:!0,toolbarExtraButtons:[]},anchorSettings:{anchorClickable:!0,enableAllAnchors:!1,markDoneStep:!0,markAllPreviousStepsAsDone:!0,removeDoneStepOnNavigateBack:!1,enableAnchorOnDoneStep:!0},keyboardSettings:{keyNavigation:!0,keyLeft:[37],keyRight:[39]},lang:{next:"Next",previous:"Previous"},disabledSteps:[],errorSteps:[],hiddenSteps:[]},s=function(){function s(t,e){_classCallCheck(this,s),this.options=v.extend(!0,{},n,e),this.main=v(t),this.nav=this._getFirstDescendant(".nav"),this.steps=this.nav.find(".nav-link"),this.container=this._getFirstDescendant(".tab-content"),this.pages=this.container.children(".tab-pane"),this._initOptions(),this._initLoad()}return _createClass(s,[{key:"_initLoad",value:function(){this.pages.hide(),this.steps.removeClass("done active"),this.current_index=null;var t=this._getStepIndex();this._setPreviousStepsDone(t),this._showStep(t)}},{key:"_initOptions",value:function(){this._setElements(),this._setToolbar(),this._setEvents()}},{key:"_getFirstDescendant",value:function(i){var n=this.main.children(i);return 0<n.length?n:(this.main.children().each(function(t,e){var s=v(e).children(i);if(0<s.length)return n=s,!1}),0<n.length?n:(this._showError("Element not found "+i),!1))}},{key:"_setElements",value:function(){this.main.addClass("sw"),this._setTheme(this.options.theme),this._setJustify(this.options.justified),!0===this.options.anchorSettings.enableAllAnchors&&!0===this.options.anchorSettings.anchorClickable||this.steps.addClass("inactive"),this._setCSSClass(this.options.disabledSteps,"disabled"),this._setCSSClass(this.options.errorSteps,"danger"),this._setCSSClass(this.options.hiddenSteps,"hidden")}},{key:"_setEvents",value:function(){var s=this;if(this.main.data("click-init"))return!0;this.main.data("click-init",!0),v(this.steps).on("click",function(t){if(t.preventDefault(),!1===s.options.anchorSettings.anchorClickable)return!0;var e=s.steps.index(t.currentTarget);return e===s.current_index||(!(!1!==s.options.anchorSettings.enableAnchorOnDoneStep||!s._isDone(e))||void(!1===s.options.anchorSettings.enableAllAnchors&&!s._isDone(e)||s._showStep(e)))}),this.main.find(".sw-btn-next").on("click",function(t){t.preventDefault(),s._showNext()}),this.main.find(".sw-btn-prev").on("click",function(t){t.preventDefault(),s._showPrevious()}),this.options.keyboardSettings.keyNavigation&&v(t).keyup(function(t){s._keyNav(t)}),this.options.backButtonSupport&&v(i).on("hashchange",function(t){var e=s._getURLHashIndex();!1!==e&&(t.preventDefault(),s._showStep(e))})}},{key:"_setToolbar",value:function(){if("none"===this.options.toolbarSettings.toolbarPosition)return!0;switch(this.options.toolbarSettings.toolbarPosition){case"top":this.container.before(this._createToolbar("top"));break;case"bottom":this.container.after(this._createToolbar("bottom"));break;case"both":this.container.before(this._createToolbar("top")),this.container.after(this._createToolbar("bottom"));break;default:this.container.after(this._createToolbar("bottom"))}}},{key:"_createToolbar",value:function(t){if(0<this.main.find(".toolbar-"+t).length)return null;var s=v("<div></div>").addClass("toolbar toolbar-"+t).attr("role","toolbar"),e=!1!==this.options.toolbarSettings.showNextButton?v("<button></button>").text(this.options.lang.next).addClass("btn sw-btn-next").attr("type","button"):null,i=!1!==this.options.toolbarSettings.showPreviousButton?v("<button></button>").text(this.options.lang.previous).addClass("btn sw-btn-prev").attr("type","button"):null;return s.append(i,e),this.options.toolbarSettings.toolbarExtraButtons&&0<this.options.toolbarSettings.toolbarExtraButtons.length&&v.each(this.options.toolbarSettings.toolbarExtraButtons,function(t,e){s.append(e.clone(!0))}),s.css("text-align",this.options.toolbarSettings.toolbarButtonPosition),s}},{key:"_showNe