src/ztfy/myams/resources/js/ext/bootstrap-wizard-1.4.2.min.js
changeset 206 02a40997d8cb
parent 202 cc928d5f90d5
equal deleted inserted replaced
205:27ed26ca8623 206:02a40997d8cb
     1 /*
     1 !function(n){var t=function(t,i){var t=n(t),e=this,a='li:has([data-toggle="tab"])',o=[],s=n.extend({},n.fn.bootstrapWizard.defaults,i),r=null,l=null;this.rebindClick=function(n,t){n.unbind("click",t).bind("click",t)},this.fixNavigationButtons=function(){if(r.length||(l.find("a:first").tab("show"),r=l.find(a+":first")),n(s.previousSelector,t).toggleClass("disabled",e.firstIndex()>=e.currentIndex()),n(s.nextSelector,t).toggleClass("disabled",e.currentIndex()>=e.navigationLength()),n(s.nextSelector,t).toggleClass("hidden",e.currentIndex()>=e.navigationLength()&&n(s.finishSelector,t).length>0),n(s.lastSelector,t).toggleClass("hidden",e.currentIndex()>=e.navigationLength()&&n(s.finishSelector,t).length>0),n(s.finishSelector,t).toggleClass("hidden",e.currentIndex()<e.navigationLength()),n(s.backSelector,t).toggleClass("disabled",0===o.length),n(s.backSelector,t).toggleClass("hidden",e.currentIndex()>=e.navigationLength()&&n(s.finishSelector,t).length>0),e.rebindClick(n(s.nextSelector,t),e.next),e.rebindClick(n(s.previousSelector,t),e.previous),e.rebindClick(n(s.lastSelector,t),e.last),e.rebindClick(n(s.firstSelector,t),e.first),e.rebindClick(n(s.finishSelector,t),e.finish),e.rebindClick(n(s.backSelector,t),e.back),s.onTabShow&&"function"==typeof s.onTabShow&&!1===s.onTabShow(r,l,e.currentIndex()))return!1},this.next=function(n){if(t.hasClass("last"))return!1;if(s.onNext&&"function"==typeof s.onNext&&!1===s.onNext(r,l,e.nextIndex()))return!1;var i=e.currentIndex(),d=e.nextIndex();d>e.navigationLength()||(o.push(i),l.find(a+(s.withVisible?":visible":"")+":eq("+d+") a").tab("show"))},this.previous=function(n){if(t.hasClass("first"))return!1;if(s.onPrevious&&"function"==typeof s.onPrevious&&!1===s.onPrevious(r,l,e.previousIndex()))return!1;var i=e.currentIndex(),d=e.previousIndex();d<0||(o.push(i),l.find(a+(s.withVisible?":visible":"")+":eq("+d+") a").tab("show"))},this.first=function(n){return(!s.onFirst||"function"!=typeof s.onFirst||!1!==s.onFirst(r,l,e.firstIndex()))&&(!t.hasClass("disabled")&&(o.push(e.currentIndex()),void l.find(a+":eq(0) a").tab("show")))},this.last=function(n){return(!s.onLast||"function"!=typeof s.onLast||!1!==s.onLast(r,l,e.lastIndex()))&&(!t.hasClass("disabled")&&(o.push(e.currentIndex()),void l.find(a+":eq("+e.navigationLength()+") a").tab("show")))},this.finish=function(n){s.onFinish&&"function"==typeof s.onFinish&&s.onFinish(r,l,e.lastIndex())},this.back=function(){if(0==o.length)return null;var n=o.pop();if(s.onBack&&"function"==typeof s.onBack&&!1===s.onBack(r,l,n))return o.push(n),!1;t.find(a+":eq("+n+") a").tab("show")},this.currentIndex=function(){return l.find(a+(s.withVisible?":visible":"")).index(r)},this.firstIndex=function(){return 0},this.lastIndex=function(){return e.navigationLength()},this.getIndex=function(n){return l.find(a+(s.withVisible?":visible":"")).index(n)},this.nextIndex=function(){var n=this.currentIndex(),t=null;do{n++,t=l.find(a+(s.withVisible?":visible":"")+":eq("+n+")")}while(t&&t.hasClass("disabled"));return n},this.previousIndex=function(){var n=this.currentIndex(),t=null;do{n--,t=l.find(a+(s.withVisible?":visible":"")+":eq("+n+")")}while(t&&t.hasClass("disabled"));return n},this.navigationLength=function(){return l.find(a+(s.withVisible?":visible":"")).length-1},this.activeTab=function(){return r},this.nextTab=function(){return l.find(a+":eq("+(e.currentIndex()+1)+")").length?l.find(a+":eq("+(e.currentIndex()+1)+")"):null},this.previousTab=function(){return e.currentIndex()<=0?null:l.find(a+":eq("+parseInt(e.currentIndex()-1)+")")},this.show=function(n){var i=isNaN(n)?t.find(a+' a[href="#'+n+'"]'):t.find(a+":eq("+n+") a");i.length>0&&(o.push(e.currentIndex()),i.tab("show"))},this.disable=function(n){l.find(a+":eq("+n+")").addClass("disabled")},this.enable=function(n){l.find(a+":eq("+n+")").removeClass("disabled")},this.hide=function(n){l.find(a+":eq("+n+")").hide()},this.display=function(n){l.find(a+":eq("+n+")").show()},this.remove=function(t){var i=t[0],e=void 0!==t[1]&&t[1],o=l.find(a+":eq("+i+")");if(e){var s=o.find("a").attr("href");n(s).remove()}o.remove()};var d=function(t){var i=l.find(a),o=i.index(n(t.currentTarget).parent(a)),d=n(i[o]);if(s.onTabClick&&"function"==typeof s.onTabClick&&!1===s.onTabClick(r,l,e.currentIndex(),o,d))return!1},u=function(t){var i=n(t.target).parent(),o=l.find(a).index(i);return!i.hasClass("disabled")&&((!s.onTabChange||"function"!=typeof s.onTabChange||!1!==s.onTabChange(r,l,e.currentIndex(),o))&&(r=i,void e.fixNavigationButtons()))};this.resetWizard=function(){n('a[data-toggle="tab"]',l).off("click",d),n('a[data-toggle="tab"]',l).off("show show.bs.tab",u),l=t.find("ul:first",t),r=l.find(a+".active",t),n('a[data-toggle="tab"]',l).on("click",d),n('a[data-toggle="tab"]',l).on("show show.bs.tab",u),e.fixNavigationButtons()},l=t.find("ul:first",t),r=l.find(a+".active",t),l.hasClass(s.tabClass)||l.addClass(s.tabClass),s.onInit&&"function"==typeof s.onInit&&s.onInit(r,l,0),s.onShow&&"function"==typeof s.onShow&&s.onShow(r,l,e.nextIndex()),n('a[data-toggle="tab"]',l).on("click",d),n('a[data-toggle="tab"]',l).on("show show.bs.tab",u)};n.fn.bootstrapWizard=function(i){if("string"==typeof i){var e=Array.prototype.slice.call(arguments,1);return 1===e.length&&e.toString(),this.data("bootstrapWizard")[i](e)}return this.each(function(e){var a=n(this);if(!a.data("bootstrapWizard")){var o=new t(a,i);a.data("bootstrapWizard",o),o.fixNavigationButtons()}})},n.fn.bootstrapWizard.defaults={withVisible:!0,tabClass:"nav nav-pills",nextSelector:".wizard li.next",previousSelector:".wizard li.previous",firstSelector:".wizard li.first",lastSelector:".wizard li.last",finishSelector:".wizard li.finish",backSelector:".wizard li.back",onShow:null,onInit:null,onNext:null,onPrevious:null,onLast:null,onFirst:null,onFinish:null,onBack:null,onTabChange:null,onTabClick:null,onTabShow:null}}(jQuery);
     2  * jQuery twitter bootstrap wizard plugin
       
     3  * Examples and documentation at: http://github.com/VinceG/twitter-bootstrap-wizard
       
     4  * version 1.4.2
       
     5  * Requires jQuery v1.3.2 or later
       
     6  * Supports Bootstrap 2.2.x, 2.3.x, 3.0
       
     7  * Dual licensed under the MIT and GPL licenses:
       
     8  * http://www.opensource.org/licenses/mit-license.php
       
     9  * http://www.gnu.org/licenses/gpl.html
       
    10  * Authors: Vadim Vincent Gabriel (http://vadimg.com), Jason Gill (www.gilluminate.com)
       
    11  */
       
    12 (function(b){var a=function(f,l){var f=b(f);var e=this;var j='li:has([data-toggle="tab"])';var h=[];var k=b.extend({},b.fn.bootstrapWizard.defaults,l);var g=null;var i=null;this.rebindClick=function(m,n){m.unbind("click",n).bind("click",n)};this.fixNavigationButtons=function(){if(!g.length){i.find("a:first").tab("show");g=i.find(j+":first")}b(k.previousSelector,f).toggleClass("disabled",(e.firstIndex()>=e.currentIndex()));b(k.nextSelector,f).toggleClass("disabled",(e.currentIndex()>=e.navigationLength()));b(k.nextSelector,f).toggleClass("hidden",(e.currentIndex()>=e.navigationLength()&&b(k.finishSelector,f).length>0));b(k.lastSelector,f).toggleClass("hidden",(e.currentIndex()>=e.navigationLength()&&b(k.finishSelector,f).length>0));b(k.finishSelector,f).toggleClass("hidden",(e.currentIndex()<e.navigationLength()));b(k.backSelector,f).toggleClass("disabled",h.length===0);b(k.backSelector,f).toggleClass("hidden",(e.currentIndex()>=e.navigationLength()&&b(k.finishSelector,f).length>0));e.rebindClick(b(k.nextSelector,f),e.next);e.rebindClick(b(k.previousSelector,f),e.previous);e.rebindClick(b(k.lastSelector,f),e.last);e.rebindClick(b(k.firstSelector,f),e.first);e.rebindClick(b(k.finishSelector,f),e.finish);e.rebindClick(b(k.backSelector,f),e.back);if(k.onTabShow&&typeof k.onTabShow==="function"&&k.onTabShow(g,i,e.currentIndex())===false){return false}};this.next=function(n){if(f.hasClass("last")){return false}if(k.onNext&&typeof k.onNext==="function"&&k.onNext(g,i,e.nextIndex())===false){return false}var o=e.currentIndex();var m=e.nextIndex();if(m>e.navigationLength()){}else{h.push(o);i.find(j+(k.withVisible?":visible":"")+":eq("+m+") a").tab("show")}};this.previous=function(n){if(f.hasClass("first")){return false}if(k.onPrevious&&typeof k.onPrevious==="function"&&k.onPrevious(g,i,e.previousIndex())===false){return false}var o=e.currentIndex();var m=e.previousIndex();if(m<0){}else{h.push(o);i.find(j+(k.withVisible?":visible":"")+":eq("+m+") a").tab("show")}};this.first=function(m){if(k.onFirst&&typeof k.onFirst==="function"&&k.onFirst(g,i,e.firstIndex())===false){return false}if(f.hasClass("disabled")){return false}h.push(e.currentIndex());i.find(j+":eq(0) a").tab("show")};this.last=function(m){if(k.onLast&&typeof k.onLast==="function"&&k.onLast(g,i,e.lastIndex())===false){return false}if(f.hasClass("disabled")){return false}h.push(e.currentIndex());i.find(j+":eq("+e.navigationLength()+") a").tab("show")};this.finish=function(m){if(k.onFinish&&typeof k.onFinish==="function"){k.onFinish(g,i,e.lastIndex())}};this.back=function(){if(h.length==0){return null}var m=h.pop();if(k.onBack&&typeof k.onBack==="function"&&k.onBack(g,i,m)===false){h.push(m);return false}f.find(j+":eq("+m+") a").tab("show")};this.currentIndex=function(){return i.find(j+(k.withVisible?":visible":"")).index(g)};this.firstIndex=function(){return 0};this.lastIndex=function(){return e.navigationLength()};this.getIndex=function(m){return i.find(j+(k.withVisible?":visible":"")).index(m)};this.nextIndex=function(){var m=this.currentIndex();var n=null;do{m++;n=i.find(j+(k.withVisible?":visible":"")+":eq("+m+")")}while((n)&&(n.hasClass("disabled")));return m};this.previousIndex=function(){var n=this.currentIndex();var m=null;do{n--;m=i.find(j+(k.withVisible?":visible":"")+":eq("+n+")")}while((m)&&(m.hasClass("disabled")));return n};this.navigationLength=function(){return i.find(j+(k.withVisible?":visible":"")).length-1};this.activeTab=function(){return g};this.nextTab=function(){return i.find(j+":eq("+(e.currentIndex()+1)+")").length?i.find(j+":eq("+(e.currentIndex()+1)+")"):null};this.previousTab=function(){if(e.currentIndex()<=0){return null}return i.find(j+":eq("+parseInt(e.currentIndex()-1)+")")};this.show=function(m){var n=isNaN(m)?f.find(j+' a[href="#'+m+'"]'):f.find(j+":eq("+m+") a");if(n.length>0){h.push(e.currentIndex());n.tab("show")}};this.disable=function(m){i.find(j+":eq("+m+")").addClass("disabled")};this.enable=function(m){i.find(j+":eq("+m+")").removeClass("disabled")};this.hide=function(m){i.find(j+":eq("+m+")").hide()};this.display=function(m){i.find(j+":eq("+m+")").show()};this.remove=function(o){var m=o[0];var p=typeof o[1]!="undefined"?o[1]:false;var n=i.find(j+":eq("+m+")");if(p){var q=n.find("a").attr("href");b(q).remove()}n.remove()};var d=function(p){var m=i.find(j);var n=m.index(b(p.currentTarget).parent(j));var o=b(m[n]);if(k.onTabClick&&typeof k.onTabClick==="function"&&k.onTabClick(g,i,e.currentIndex(),n,o)===false){return false}};var c=function(o){var n=b(o.target).parent();var m=i.find(j).index(n);if(n.hasClass("disabled")){return false}if(k.onTabChange&&typeof k.onTabChange==="function"&&k.onTabChange(g,i,e.currentIndex(),m)===false){return false}g=n;e.fixNavigationButtons()};this.resetWizard=function(){b('a[data-toggle="tab"]',i).off("click",d);b('a[data-toggle="tab"]',i).off("show show.bs.tab",c);i=f.find("ul:first",f);g=i.find(j+".active",f);b('a[data-toggle="tab"]',i).on("click",d);b('a[data-toggle="tab"]',i).on("show show.bs.tab",c);e.fixNavigationButtons()};i=f.find("ul:first",f);g=i.find(j+".active",f);if(!i.hasClass(k.tabClass)){i.addClass(k.tabClass)}if(k.onInit&&typeof k.onInit==="function"){k.onInit(g,i,0)}if(k.onShow&&typeof k.onShow==="function"){k.onShow(g,i,e.nextIndex())}b('a[data-toggle="tab"]',i).on("click",d);b('a[data-toggle="tab"]',i).on("show show.bs.tab",c)};b.fn.bootstrapWizard=function(d){if(typeof d=="string"){var c=Array.prototype.slice.call(arguments,1);if(c.length===1){c.toString()}return this.data("bootstrapWizard")[d](c)}return this.each(function(e){var f=b(this);if(f.data("bootstrapWizard")){return}var g=new a(f,d);f.data("bootstrapWizard",g);g.fixNavigationButtons()})};b.fn.bootstrapWizard.defaults={withVisible:true,tabClass:"nav nav-pills",nextSelector:".wizard li.next",previousSelector:".wizard li.previous",firstSelector:".wizard li.first",lastSelector:".wizard li.last",finishSelector:".wizard li.finish",backSelector:".wizard li.back",onShow:null,onInit:null,onNext:null,onPrevious:null,onLast:null,onFirst:null,onFinish:null,onBack:null,onTabChange:null,onTabClick:null,onTabShow:null}})(jQuery);