!function(t){function i(t,i){this.init(t,i)}i.prototype={init:function(i,n){this.ele=i,this.opts=t.extend({},{index:0,auto:!0,time:4e3,indicators:!0,buttons:!0},n),this.index=this.opts.index,this.render(),this.eventbind(),this.opts.auto&&this.loop()},render:function(){this.rencas(),this.opts.indicators&&this.renins(),this.opts.buttons&&this.renbtns()},rencas:function(){var t=this.ele.find(".carousel-inner"),i=t.find(".carousel-item"),n=i.length,e=i.eq(n-1).clone(),s=i.eq(0).clone(),o=this.ele.width();this.index=this.index<0||this.index>n-1?0:this.index,t.width((n+2)*o).prepend(e).append(s).css("left",(this.index+1)*-o),t.find(".carousel-item").width(o)},renins:function(){for(var t=this.ele.find(".carousel-item").length-2,i='
',n=0;n';i+="
",this.ele.append(i).find(".carousel-indicators span").eq(this.index).addclass("active")},renbtns:function(){this.ele.append('')},animate:function(t){var i=this,n=this.ele.find(".carousel-inner"),e=this.ele.width(),s=n.find(".carousel-item").length;this.opts.indicators;n.stop(!0,!0).animate({left:n.position().left+t},function(){var o=n.position().left;t<0&&o<-e*(s-2)&&n.css("left",-e),t>0&&o>-e&&n.css("left",-e*(s-2)),i.index=n.position().left/-e-1,i.opts.buttons&&i.showbtn()})},showbtn:function(){this.ele.find(".carousel-indicators span").removeclass("active").eq(this.index).addclass("active")},loop:function(){var t=this.ele.find(".carousel-next-btn");this.timer=setinterval(function(){t.trigger("click")},this.opts.time)},eventbind:function(){var i=this,n=this.ele.find(".carousel-prev-btn"),e=this.ele.find(".carousel-next-btn"),s=this.ele.find(".carousel-indicators"),o=this.ele.width(),a=(this.ele.find(".carousel-item").length,this.opts.auto);e.on("click",function(){i.animate(-o)}),n.on("click",function(){i.animate(o)}),s.on("click","span",function(){i.animate((t(this).data("index")-i.index)*-o)}),a&&this.ele.hover(function(){clearinterval(i.timer)},function(){i.loop()})}},t.fn.ftcarousel=function(n){return this.each(function(){new i(t(this),n)})}}(jquery);