File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
/*
SlidesJS 3.0.4 http://slidesjs.com
(c) 2013 by Nathan Searles http://nathansearles.com
Updated: June 26th, 2013
Apache License: http://www.apache.org/licenses/LICENSE-2.0
*/
(function(){(function(e,t,n){var r,i,s;s="slidesjs";i={width:940,height:528,start:1,dataKey:"",navigation:{active:true,effect:"slide"},pagination:{active:true,effect:"slide"},play:{active:false,effect:"slide",interval:5e3,auto:false,swap:true,pauseOnHover:false,restartDelay:2500},effect:{slide:{speed:500},fade:{speed:300,crossfade:true}},callback:{loaded:function(){},start:function(){},complete:function(){}}};r=function(){function t(t,n){this.element=t;this.options=e.extend(true,{},i,n);this._defaults=i;this._name=s;this.init()}return t}();r.prototype.init=function(){var n=this.options.dataKey;var r,i,s,o,u,a,f=this;r=e(this.element);this.data=e.data(this);e.data(this,"animating",false);e.data(this,"total",r.children().not(".slidesjs-navigation",r).length);e.data(this,"current",this.options.start-1);e.data(this,"vendorPrefix",this._getVendorPrefix());if(typeof TouchEvent!=="undefined"){e.data(this,"touch",true);this.options.effect.slide.speed=this.options.effect.slide.speed/2}r.css({overflow:"hidden"});r.slidesContainer=r.children().not(".slidesjs-navigation",r).wrapAll("<div class='slidesjs-container_"+n+"'>",r).parent().css({overflow:"hidden",position:"relative"});e(".slidesjs-container_"+n,r).wrapInner("<div class='slidesjs-control_"+n+"'>",r).children();e(".slidesjs-control_"+n,r).css({position:"relative",left:0});e(".slidesjs-control_"+n,r).children().addClass("slidesjs-slide").css({position:"absolute",top:0,left:0,width:"100%",zIndex:0,display:"none",webkitBackfaceVisibility:"hidden"});e.each(e(".slidesjs-control_"+n,r).children(),function(t){var n;n=e(this);return n.attr("slidesjs-index",t)});if(this.data.touch){e(".slidesjs-control_"+n,r).on("touchstart",function(e){return f._touchstart(e)});e(".slidesjs-control_"+n,r).on("touchmove",function(e){return f._touchmove(e)});e(".slidesjs-control_"+n,r).on("touchend",function(e){return f._touchend(e)})}r.fadeIn(0);this.update(n);if(this.data.touch){this._setuptouch(n)}e(".slidesjs-control_"+n,r).children(":eq("+this.data.current+")").eq(0).fadeIn(0,function(){return e(this).css({zIndex:10})});if(this.options.navigation.active){u=e("<a>",{"class":"slidesjs-previous_"+n+" slidesjs-navigation",href:"#",title:"Previous",text:"Previous"}).appendTo(r);u.wrapAll("<div class='visualArea_"+n+"'>",r);i=e("<a>",{"class":"slidesjs-next_"+n+" slidesjs-navigation",href:"#",title:"Next",text:"Next"}).appendTo(r);i.wrapAll("<div class='visualArea_"+n+"'>",r)}e(".slidesjs-next_"+n,r).click(function(e){e.preventDefault();f.stop(true,n);return f.next(f.options.navigation.effect,n)});e(".slidesjs-previous_"+n,r).click(function(e){e.preventDefault();f.stop(true,n);return f.previous(f.options.navigation.effect,n)});if(this.options.play.active){o=e("<a>",{"class":"slidesjs-play_"+n+" slidesjs-navigation",href:"#",title:"Play",text:"Play"}).appendTo(r);o.wrapAll("<div class='visualArea_"+n+"'>",r);a=e("<a>",{"class":"slidesjs-stop_"+n+" slidesjs-navigation",href:"#",title:"Stop",text:"Stop"}).appendTo(r);a.wrapAll("<div class='visualArea_"+n+"'>",r);e(".slidesjs-play_"+n,r).click(function(e){e.preventDefault();return f.play(true,n)});e(".slidesjs-stop_"+n,r).click(function(e){e.preventDefault();return f.stop(true,n)});if(this.options.play.swap){a.css({display:"none"})}}if(this.options.pagination.active){s=e("<ul>",{"class":"slidesjs-pagination_"+n}).appendTo(r);e.each(new Array(this.data.total),function(t){var r,i;r=e("<li>",{"class":"slidesjs-pagination-item_"+n}).appendTo(s);i=e("<a>",{href:"#","data-slidesjs-item":t,html:t+1}).appendTo(r);return i.click(function(t){t.preventDefault();f.stop(true,n);return f.goto(e(t.currentTarget).attr("data-slidesjs-item")*1+1,n)})});s.wrapAll("<div class='visualArea_"+n+"'>",r)}e(t).bind("resize",function(){return f.update(n)});this._setActive(0,n);if(this.options.play.auto){this.play(0,n)}return this.options.callback.loaded(this.options.start)};r.prototype._setActive=function(t,n){var r,i;r=e(this.element);this.data=e.data(this);i=t>-1?t:this.data.current;e(".active",r).removeClass("active");return e(".slidesjs-pagination_"+n+" li:eq("+i+") a",r).addClass("active")};r.prototype.update=function(t){var n,r,i;n=e(this.element);this.data=e.data(this);e(".slidesjs-control_"+t,n).children(":not(:eq("+this.data.current+"))").css({display:"none",left:0,zIndex:0});i=n.width();r=this.options.height/this.options.width*i;this.options.width=i;this.options.height=r;return e(".slidesjs-control_"+t+", .slidesjs-container_"+t+"",n).css({width:i,height:r})};r.prototype.next=function(t,n){var r;r=e(this.element);this.data=e.data(this);e.data(this,"direction","next");if(t===void 0){t=this.options.navigation.effect}if(t==="fade"){return this._fade(0,n)}else{return this._slide(-1,n)}};r.prototype.previous=function(t,n){var r;r=e(this.element);this.data=e.data(this);e.data(this,"direction","previous");if(t===void 0){t=this.options.navigation.effect}if(t==="fade"){return this._fade(0,n)}else{return this._slide(-1,n)}};r.prototype.goto=function(t,n){var r,i;r=e(this.element);this.data=e.data(this);if(i===void 0){i=this.options.pagination.effect}if(t>this.data.total){t=this.data.total}else if(t<1){t=1}if(typeof t==="number"){if(i==="fade"){return this._fade(t,n)}else{return this._slide(t,n)}}else if(typeof t==="string"){if(t==="first"){if(i==="fade"){return this._fade(0,n)}else{return this._slide(-1,n)}}else if(t==="last"){if(i==="fade"){return this._fade(this.data.total,n)}else{return this._slide(this.data.total,n)}}}};r.prototype._setuptouch=function(t){var n,r,i,s;n=e(this.element);this.data=e.data(this);s=e(".slidesjs-control_"+t,n);r=this.data.current+1;i=this.data.current-1;if(i<0){i=this.data.total-1}if(r>this.data.total-1){r=0}s.children(":eq("+r+")").css({display:"block",left:this.options.width});return s.children(":eq("+i+")").css({display:"block",left:-this.options.width})};r.prototype._touchstart=function(t){var n,r;n=e(this.element);this.data=e.data(this);r=t.originalEvent.touches[0];this._setuptouch(dataKey);e.data(this,"touchtimer",Number(new Date));e.data(this,"touchstartx",r.pageX);e.data(this,"touchstarty",r.pageY);return t.stopPropagation()};r.prototype._touchend=function(t){var n,r,i,s,o,u,a,f=this;n=e(this.element);this.data=e.data(this);u=t.originalEvent.touches[0];s=e(".slidesjs-control_"+dataKey,n);if(s.position().left>this.options.width*.5||s.position().left>this.options.width*.1&&Number(new Date)-this.data.touchtimer<250){e.data(this,"direction","previous");this._slide(-1,dataKey)}else if(s.position().left<-(this.options.width*.5)||s.position().left<-(this.options.width*.1)&&Number(new Date)-this.data.touchtimer<250){e.data(this,"direction","next");this._slide(-1,dataKey)}else{i=this.data.vendorPrefix;a=i+"Transform";r=i+"TransitionDuration";o=i+"TransitionTimingFunction";s[0].style[a]="translateX(0px)";s[0].style[r]=this.options.effect.slide.speed*.85+"ms"}s.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",function(){i=f.data.vendorPrefix;a=i+"Transform";r=i+"TransitionDuration";o=i+"TransitionTimingFunction";s[0].style[a]="";s[0].style[r]="";return s[0].style[o]=""});return t.stopPropagation()};r.prototype._touchmove=function(t){var n,r,i,s,o;n=e(this.element);this.data=e.data(this);s=t.originalEvent.touches[0];r=this.data.vendorPrefix;i=e(".slidesjs-control_"+dataKey,n);o=r+"Transform";e.data(this,"scrolling",Math.abs(s.pageX-this.data.touchstartx)<Math.abs(s.pageY-this.data.touchstarty));if(!this.data.animating&&!this.data.scrolling){t.preventDefault();this._setuptouch(dataKey);i[0].style[o]="translateX("+(s.pageX-this.data.touchstartx)+"px)"}return t.stopPropagation()};r.prototype.play=function(t,n){var r,i,s,o=this;r=e(this.element);this.data=e.data(this);if(!this.data.playInterval){if(t){i=this.data.current;this.data.direction="next";if(this.options.play.effect==="fade"){this._fade(0,n)}else{this._slide(-1,n)}}e.data(this,"playInterval",setInterval(function(){i=o.data.current;o.data.direction="next";if(o.options.play.effect==="fade"){return o._fade(0,n)}else{return o._slide(-1,n)}},this.options.play.interval));s=e(".slidesjs-container_"+n,r);if(this.options.play.pauseOnHover){s.unbind();s.bind("mouseenter",function(){return o.stop(false,n)});s.bind("mouseleave",function(){if(o.options.play.restartDelay){return e.data(o,"restartDelay",setTimeout(function(){return o.play(true,n)},o.options.play.restartDelay))}else{return o.play(false,n)}})}e.data(this,"playing",true);e(".slidesjs-play_"+n,r).addClass("slidesjs-playing");if(this.options.play.swap){e(".slidesjs-play_"+n,r).hide();return e(".slidesjs-stop_"+n,r).show()}}};r.prototype.stop=function(t,n){var r;r=e(this.element);this.data=e.data(this);clearInterval(this.data.playInterval);if(this.options.play.pauseOnHover&&t){e(".slidesjs-container_"+n,r).unbind()}e.data(this,"playInterval",null);e.data(this,"playing",false);e(".slidesjs-play_"+n,r).removeClass("slidesjs-playing");if(this.options.play.swap){e(".slidesjs-stop_"+n,r).hide();return e(".slidesjs-play_"+n,r).show()}};r.prototype._slide=function(t,n){var r,i,s,o,u,a,f,l,c,h,p=this;r=e(this.element);this.data=e.data(this);if(!this.data.animating&&t!==this.data.current+1){e.data(this,"animating",true);i=this.data.current;if(t>-1){t=t-1;h=t>i?1:-1;s=t>i?-this.options.width:this.options.width;u=t}else{h=this.data.direction==="next"?1:-1;s=this.data.direction==="next"?-this.options.width:this.options.width;u=i+h}if(u===-1){u=this.data.total-1}if(u===this.data.total){u=0}this._setActive(u,n);f=e(".slidesjs-control_"+n,r);if(t>-1){f.children(":not(:eq("+i+"))").css({display:"none",left:0,zIndex:0})}f.children(":eq("+u+")").css({display:"block",left:h*this.options.width,zIndex:10});this.options.callback.start(i+1);if(this.data.vendorPrefix){a=this.data.vendorPrefix;c=a+"Transform";o=a+"TransitionDuration";l=a+"TransitionTimingFunction";f[0].style[c]="translateX("+s+"px)";f[0].style[o]=this.options.effect.slide.speed+"ms";return f.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",function(){f[0].style[c]="";f[0].style[o]="";f.children(":eq("+u+")").css({left:0});f.children(":eq("+i+")").css({display:"none",left:0,zIndex:0});e.data(p,"current",u);e.data(p,"animating",false);f.unbind("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd");f.children(":not(:eq("+u+"))").css({display:"none",left:0,zIndex:0});if(p.data.touch){p._setuptouch(n)}return p.options.callback.complete(u+1)})}else{return f.stop(false,n).animate({left:s},this.options.effect.slide.speed,function(){f.css({left:0});f.children(":eq("+u+")").css({left:0});return f.children(":eq("+i+")").css({display:"none",left:0,zIndex:0},e.data(p,"current",u),e.data(p,"animating",false),p.options.callback.complete(u+1))})}}};r.prototype._fade=function(t,n){var r,i,s,o,u,a=this;r=e(this.element);this.data=e.data(this);if(!this.data.animating&&t!==this.data.current+1){e.data(this,"animating",true);i=this.data.current;if(t){t=t-1;u=t>i?1:-1;s=t}else{u=this.data.direction==="next"?1:-1;s=i+u}if(s===-1){s=this.data.total-1}if(s===this.data.total){s=0}this._setActive(s,n);o=e(".slidesjs-control_"+n,r);o.children(":eq("+s+")").css({display:"none",left:0,zIndex:10});this.options.callback.start(i+1);if(this.options.effect.fade.crossfade){o.children(":eq("+this.data.current+")").stop(false,n).fadeOut(this.options.effect.fade.speed);return o.children(":eq("+s+")").stop(false,n).fadeIn(this.options.effect.fade.speed,function(){o.children(":eq("+s+")").css({zIndex:0});e.data(a,"animating",false);e.data(a,"current",s);return a.options.callback.complete(s+1)})}else{return o.children(":eq("+i+")").stop(false,n).fadeOut(this.options.effect.fade.speed,function(){o.children(":eq("+s+")").stop(false,n).fadeIn(a.options.effect.fade.speed,function(){return o.children(":eq("+s+")").css({zIndex:10})});e.data(a,"animating",false);e.data(a,"current",s);return a.options.callback.complete(s+1)})}}};r.prototype._getVendorPrefix=function(){var e,t,r,i,s;e=n.body||n.documentElement;r=e.style;i="transition";s=["Moz","Webkit","Khtml","O","ms"];i=i.charAt(0).toUpperCase()+i.substr(1);t=0;while(t<s.length){if(typeof r[s[t]+i]==="string"){return s[t]}t++}return false};return e.fn[s]=function(t){return this.each(function(){if(!e.data(this,"plugin_"+s)){return e.data(this,"plugin_"+s,new r(this,t))}})}})(jQuery,window,document)}).call(this);