4 lines
11 KiB
JavaScript
4 lines
11 KiB
JavaScript
|
/*! jQuery wizard - v0.3.1 - 2015-05-07
|
||
|
* https://github.com/amazingSurge/jquery-wizard
|
||
|
* Copyright (c) 2015 amazingSurge; Licensed GPL */
|
||
|
!function(a,b,c,d){"use strict";function e(a,b){var c=!1;a.one(g.transition.end,function(){c=!0});var d=function(){c||a.trigger(g.transition.end)};setTimeout(d,b)}function f(){return this.initialize.apply(this,Array.prototype.slice.call(arguments))}var g=function(){function b(b,c){var g=!1,h=b.charAt(0).toUpperCase()+b.slice(1);return e[b]!==d&&(g=b),g||a.each(f,function(a,b){return e[b+h]!==d?(g="-"+b.toLowerCase()+"-"+h,!1):void 0}),c?g:g?!0:!1}function c(a){return b(a,!0)}var e=a("<support>").get(0).style,f=["webkit","Moz","O","ms"],g={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}}},h={csstransitions:function(){return!!b("transition")}},i={};return h.csstransitions()&&(i.transition=new String(c("transition")),i.transition.end=g.transition.end[i.transition]),i}(),h=0,i=function(b,c){this.$element=a(b),this.options=a.extend(!0,{},i.defaults,c),this.$steps=this.$element.find(this.options.step),this.id=this.$element.attr("id"),this.id||(this.id="wizard-"+ ++h,this.$element.attr("id",this.id)),this.initialize()};i.defaults={step:".wizard-steps > li",getPane:function(a,b){return this.$element.find(".wizard-content").children().eq(a)},buttonsAppendTo:"this",templates:{buttons:function(){var a=this.options;return'<div class="wizard-buttons"><a class="wizard-back" href="#'+this.id+'" data-wizard="back" role="button">'+a.buttonLabels.back+'</a><a class="wizard-next" href="#'+this.id+'" data-wizard="next" role="button">'+a.buttonLabels.next+'</a><a class="wizard-finish" href="#'+this.id+'" data-wizard="finish" role="button">'+a.buttonLabels.finish+"</a></div>"}},classes:{step:{done:"done",error:"error",active:"current",disabled:"disabled",activing:"activing",loading:"loading"},pane:{active:"active",activing:"activing"},button:{hide:"hide",disabled:"disabled"}},autoFocus:!0,keyboard:!0,enableWhenVisited:!1,buttonLabels:{next:"Next",back:"Back",finish:"Finish"},loading:{show:function(a){},hide:function(a){},fail:function(a){}},cacheContent:!1,validator:function(a){return!0},onInit:null,onNext:null,onBack:null,onReset:null,onBeforeShow:null,onAfterShow:null,onBeforeHide:null,onAfterHide:null,onBeforeLoad:null,onAfterLoad:null,onBeforeChange:null,onAfterChange:null,onStateChange:null,onFinish:null},a.extend(f.prototype,{TRANSITION_DURATION:200,initialize:function(b,c,d){this.$element=a(b),this.wizard=c,this.events={},this.loader=null,this.loaded=!1,this.validator=this.wizard.options.validator,this.states={done:!1,error:!1,active:!1,disabled:!1,activing:!1},this.index=d,this.$element.data("wizard-index",d),this.$pane=this.getPaneFromTarget(),this.$pane||(this.$pane=this.wizard.options.getPane.call(this.wizard,d,b)),this.setValidatorFromData(),this.setLoaderFromData()},getPaneFromTarget:function(){var b=this.$element.data("target");return b||(b=this.$element.attr("href"),b=b&&b.replace(/.*(?=#[^\s]*$)/,"")),b?a(b):null},setup:function(){var a=this.wizard.currentIndex();this.index===a?(this.enter("active"),this.loader&&this.load()):this.index>a&&this.enter("disabled"),this.$element.attr("aria-expanded",this.is("active")),this.$pane.attr("aria-expanded",this.is("active"));var b=this.wizard.options.classes;this.is("active")?this.$pane.addClass(b.pane.active):this.$pane.removeClass(b.pane.active)},show:function(b){if(!this.is("activing")&&!this.is("active")){this.trigger("beforeShow"),this.enter("activing");var c=this.wizard.options.classes;this.$element.attr("aria-expanded",!0),this.$pane.addClass(c.pane.activing).addClass(c.pane.active).attr("aria-expanded",!0);var d=function(){this.$pane.removeClass(c.pane.activing),this.leave("activing"),this.enter("active"),this.trigger("afterShow"),a.isFunction(b)&&b.call(this)};if(!g.transition)return d.call(this);this.$pane.one(g.transition.end,a.proxy(d,this)),e(this.$pane,this.TRANSITION_DURATION)}},hide:function(b){if(!this.is("activing")&&this.is("active")){this.trigger("beforeHide"),this.enter("activing");var c=this.wizard.options.classes;this.$element.attr("aria-expanded",!1),this.$pane.addClass
|