//Angular Carousel - Mobile friendly touch carousel for AngularJS //@version v0.3.12 - 2015-06-11 //@link http://revolunet.github.com/angular-carousel //@author Julien Bouquillon //@license MIT License, http://www.opensource.org/licenses/MIT //Angular touch carousel with CSS GPU accel and slide buffering //http://github.com/revolunet/angular-carousel // Modified by PP for mobile friendly touch, start without auto slide but enabled it if tapped // and logic to wait for an image to load before it slides to the next one // /* jshint ignore:start */ /*global angular */ angular.module("angular-carousel",["ngTouch","angular-carousel.shifty"]),angular.module("angular-carousel").directive("rnCarouselAutoSlide",["$interval","$timeout","imageLoadingDataShare","carouselUtils",function(t,e,n,r){return{restrict:"A",link:function(t,e,n){var i=function(){t.autoSlider&&(t.autoSlider=null)},o=function(){0==r.isStopped()&&t.autoSlide()},a=function(){r.setStop(!r.getStop()),r.isStopped()&&r.setIndex(t.carouselIndex),t.autoSlider?(r.setStop(!0),r.setIndex(t.carouselIndex),i()):(r.setStop(!1),o())} r.setStop(!1),t.$watch("carouselIndex",o),n.hasOwnProperty("rnCarouselPauseOnHover")&&"false"!==n.rnCarouselPauseOnHover&&(n.hasOwnProperty("rnPlatform")&&"desktop"==n.rnPlatform?(e.off("click",a),e.on("click",a)):(e.off("touchend",a),e.on("touchend",a))),t.$on("$destroy",function(){i(),e.off("touchend",a),e.off("click",a)})}}}]),angular.module("angular-carousel").directive("rnCarouselIndicators",["$parse",function(t){return{restrict:"A",scope:{slides:"=",index:"=rnCarouselIndex"},templateUrl:"carousel-indicators.html",link:function(e,n,r){var i=t(r.rnCarouselIndex) e.goToSlide=function(t){i.assign(e.$parent.$parent,t)}}}}]),angular.module("angular-carousel").run(["$templateCache",function(t){t.put("carousel-indicators.html",'')}]),function(){"use strict" angular.module("angular-carousel").service("DeviceCapabilities",function(){function t(){var t="transform",e="webkitTransform" return"undefined"!=typeof document.body.style[t]?["webkit","moz","o","ms"].every(function(e){var n="-"+e+"-transform" return"undefined"==typeof document.body.style[n]||(t=n,!1)}):t="undefined"!=typeof document.body.style[e]?"-webkit-transform":void 0,t}function e(){var t,e=document.createElement("p"),n={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",transform:"transform"} document.body.insertBefore(e,null) for(var r in n)void 0!==e.style[r]&&(e.style[r]="translate3d(1px,1px,1px)",t=window.getComputedStyle(e).getPropertyValue(n[r])) return document.body.removeChild(e),void 0!==t&&t.length>0&&"none"!==t}return{has3d:e(),transformProperty:t()}}).service("computeCarouselSlideStyle",["DeviceCapabilities",function(t){return function(e,n,r){var i,o={display:"inline-block"},a=100*e+n,u=t.has3d?"translate3d("+a+"%, 0, 0)":"translate3d("+a+"%, 0)",s=(100-Math.abs(a))/100 if(t.transformProperty)if("fadeAndSlide"==r)o[t.transformProperty]=u,i=0,Math.abs(a)<100&&(i=.3+.7*s),o.opacity=i else if("hexagon"==r){var c=100,l=0,f=60*(s-1) c=n li")}function _(t){N=!0,F({x:t.clientX,y:t.clientY},t)}function I(t){var e=100*a.carouselBufferIndex+t angular.forEach(w(),function(t,n){t.style.cssText=s(u(n,e,z.transitionType))})}function x(t,e){if(void 0===t&&(t=a.carouselIndex),e=e||{},e.animate===!1||"none"===z.transitionType)return U=!1,R=t*-100,a.carouselIndex=t,void O() U=!0 var n=new c n.tween({from:{x:R},to:{x:t*-100},duration:z.transitionDuration,easing:z.transitionEasing,step:function(t){I(t.x)},finish:function(){a.$apply(function(){a.carouselIndex=t,R=t*-100,O(),o(function(){U=!1},0,!1)})}})}function C(){var t=p[0].getBoundingClientRect() return t.width?t.width:t.right-t.left}function b(){Q=C()}function k(){j||(j=!0,n.bind("mouseup",_))}function M(){j&&(j=!1,n.unbind("mouseup",_))}function T(t,e){if(!(U||H.length<=1))return b(),L=p[0].querySelector("li").getBoundingClientRect().left,D=!0,A=t.x,!1}function P(t,e){var n,r if(k(),D&&(n=t.x,r=A-n,r>2||r<-2)){N=!0 var i=R+100*-r/Q I(i)}return!1}function F(t,e,n){if((!e||N)&&(M(),D=!1,N=!1,B=A-t.x,0!==B&&!U))if(R+=100*-B/Q,z.isSequential){var i=z.moveTreshold*Q,o=-B,u=-Math[o>=0?"ceil":"floor"](o/Q),s=Math.abs(o)>i H&&u+a.carouselIndex>=H.length&&(u=H.length-1-a.carouselIndex),u+a.carouselIndex<0&&(u=-a.carouselIndex) var c=s?u:0 B=a.carouselIndex+c,x(B),void 0!==g.rnCarouselOnInfiniteScrollRight&&0===u&&0!==a.carouselIndex&&(r(g.rnCarouselOnInfiniteScrollRight)(a),x(0)),void 0!==g.rnCarouselOnInfiniteScrollLeft&&0===u&&0===a.carouselIndex&&0===c&&(r(g.rnCarouselOnInfiniteScrollLeft)(a),x(H.length))}else a.$apply(function(){a.carouselIndex=parseInt(-R/100,10),O()})}function O(){var t=0,e=(a.carouselBufferSize-1)/2 S?(t=a.carouselIndex<=e?0:H&&H.lengthH.length-a.carouselBufferSize?H.length-a.carouselBufferSize:a.carouselIndex-e,a.carouselBufferIndex=t,o(function(){I(R)},0,!1)):o(function(){I(R)},0,!1)}function $(){b(),x()}h++ var D,A,B,q={transitionType:g.rnCarouselTransition||"slide",transitionEasing:g.rnCarouselEasing||"easeTo",transitionDuration:parseFloat(g.rnCarouselDuration,10)||300,isSequential:!0,autoSlideDuration:3,bufferSize:9,moveTreshold:.1,defaultIndex:0},z=angular.extend({},q),E=!1,R=0,N=!1,H=[],Q=null,L=null,j=!1,U=!1 "true"!==g.rnSwipeDisabled&&t.bind(p,{start:T,move:P,end:F,cancel:function(t){F({},t)}}),a.nextSlide=function(t){if(1!=f.isStopped()){var e=a.carouselIndex+1 e>H.length-1&&e--,1!=l.get()?x(e,t):a.autoSlide()}},a.prevSlide=function(t){var e=a.carouselIndex-1 e<0&&(e=H.length-1),x(e,t)} var W=!0 if(a.carouselIndex=0,y||(H=[],angular.forEach(w(),function(t,e){H.push({id:e})})),void 0!==g.rnCarouselControls){var Y=y?m.replace("::","")+".length - 1":H.length-1,G='' p.parent().append(i(angular.element(G))(a))}if(void 0!==g.rnCarouselAutoSlide){var V=parseFloat(g.rnCarouselAutoSlide,10)||z.autoSlideDuration f.setDuration(V),console.log("Setting duration - should only happen once"),a.autoSlide=function(){if(a.autoSlider&&(a.autoSlider=null),0==f.isStopped()){var t=f.getDuration(),e=1e3*t e<5&&(console.log("duration is too small at "+e+" making it to 5"),e=5),a.autoSlider=o(function(){a.nextSlide()},e)}else console.log("We are stopped, doing nothing")}}if(g.rnCarouselDefaultIndex){var X=r(g.rnCarouselDefaultIndex) z.defaultIndex=X(a.$parent)||0}var J=null if(g.rnCarouselIndex){var K=function(t){t<0||Z.assign(a.$parent,t)},Z=r(g.rnCarouselIndex) angular.isFunction(Z.assign)?(a.$watch("carouselIndex",function(t){K(t)}),a.$parent.$watch(function(){return Z(a.$parent)},function(t,e){J=t,void 0!==t&&null!==t&&(H&&H.length>0&&t>=H.length?(t=H.length-1,K(t)):H&&t<0&&(t=0,K(t)),U||x(t,{animate:!W}),W=!1)}),E=!0,z.defaultIndex&&x(z.defaultIndex,{animate:!W})):isNaN(g.rnCarouselIndex)||x(parseInt(g.rnCarouselIndex,10),{animate:!1})}else x(z.defaultIndex,{animate:!W}),W=!1 if(g.rnCarouselLocked&&a.$watch(g.rnCarouselLocked,function(t,e){U=t===!0}),y){var tt=void 0!==g.rnCarouselDeepWatch a[tt?"$watch":"$watchCollection"](m,function(t,e){if(H=t,J&&(a.carouselIndex=J,J=null),tt&&angular.isArray(t)){var n=e[a.carouselIndex],r=d(t,n,a.carouselIndex) x(r,{animate:!1})}else x(a.carouselIndex,{animate:!1})},!0)}a.$on("$destroy",function(){M()}),a.carouselBufferIndex=0,a.carouselBufferSize=z.bufferSize var et=angular.element(e) et.bind("orientationchange",$),et.bind("resize",$),a.$on("$destroy",function(){M(),et.unbind("orientationchange",$),et.unbind("resize",$)})}}}}])}(),angular.module("angular-carousel.shifty",[]).factory("Tweenable",function(){return function(t){var e=function(){"use strict" function e(){}function n(t,e){var n for(n in t)Object.hasOwnProperty.call(t,n)&&e(n)}function r(t,e){return n(e,function(n){t[n]=e[n]}),t}function i(t,e){n(e,function(n){"undefined"==typeof t[n]&&(t[n]=e[n])})}function o(t,e,n,r,i,o,u){var s,c=(t-o)/i for(s in e)e.hasOwnProperty(s)&&(e[s]=a(n[s],r[s],f[u[s]],c)) return e}function a(t,e,n,r){return t+(e-t)*n(r)}function u(t,e){var r=l.prototype.filter,i=t._filterArgs n(r,function(n){"undefined"!=typeof r[n][e]&&r[n][e].apply(t,i)})}function s(t,e,n,r,i,a,s,c,l){w=e+n,y=Math.min(v(),w),S=y>=w,_=n-(w-y),t.isPlaying()&&!S?(t._scheduleId=l(t._timeoutHandler,g),u(t,"beforeTween"),o(y,r,i,a,n,e,s),u(t,"afterTween"),c(r,t._attachment,_)):S&&(c(a,t._attachment,_),t.stop(!0))}function c(t,e){var r={} return"string"==typeof e?n(t,function(t){r[t]=e}):n(t,function(t){r[t]||(r[t]=e[t]||h)}),r}function l(t,e){this._currentState=t||{},this._configured=!1,this._scheduleFunction=d,"undefined"!=typeof e&&this.setConfig(e)}var f,d,h="linear",p=500,g=1e3/60,m=Date.now?Date.now:function(){return+new Date},v="undefined"!=typeof SHIFTY_DEBUG_NOW?SHIFTY_DEBUG_NOW:m d="undefined"!=typeof window?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||window.mozCancelRequestAnimationFrame&&window.mozRequestAnimationFrame||setTimeout:setTimeout var w,y,S,_ return l.prototype.tween=function(t){return this._isTweening?this:(void 0===t&&this._configured||this.setConfig(t),this._timestamp=v(),this._start(this.get(),this._attachment),this.resume())},l.prototype.setConfig=function(t){t=t||{},this._configured=!0,this._attachment=t.attachment,this._pausedAtTime=null,this._scheduleId=null,this._start=t.start||e,this._step=t.step||e,this._finish=t.finish||e,this._duration=t.duration||p,this._currentState=t.from||this.get(),this._originalState=this.get(),this._targetState=t.to||this.get() var n=this._currentState,r=this._targetState return i(r,n),this._easing=c(n,t.easing||h),this._filterArgs=[n,this._originalState,r,this._easing],u(this,"tweenCreated"),this},l.prototype.get=function(){return r({},this._currentState)},l.prototype.set=function(t){this._currentState=t},l.prototype.pause=function(){return this._pausedAtTime=v(),this._isPaused=!0,this},l.prototype.resume=function(){this._isPaused&&(this._timestamp+=v()-this._pausedAtTime),this._isPaused=!1,this._isTweening=!0 var t=this return this._timeoutHandler=function(){s(t,t._timestamp,t._duration,t._currentState,t._originalState,t._targetState,t._easing,t._step,t._scheduleFunction)},this._timeoutHandler(),this},l.prototype.seek=function(t){return this._timestamp=v()-t,this.isPlaying()||(this._isTweening=!0,this._isPaused=!1,s(this,this._timestamp,this._duration,this._currentState,this._originalState,this._targetState,this._easing,this._step,this._scheduleFunction),this._timeoutHandler(),this.pause()),this},l.prototype.stop=function(n){return this._isTweening=!1,this._isPaused=!1,this._timeoutHandler=e,(t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.oCancelAnimationFrame||t.msCancelAnimationFrame||t.mozCancelRequestAnimationFrame||t.clearTimeout)(this._scheduleId),n&&(r(this._currentState,this._targetState),u(this,"afterTweenEnd"),this._finish.call(this,this._currentState,this._attachment)),this},l.prototype.isPlaying=function(){return this._isTweening&&!this._isPaused},l.prototype.setScheduleFunction=function(t){this._scheduleFunction=t},l.prototype.dispose=function(){var t for(t in this)this.hasOwnProperty(t)&&delete this[t]},l.prototype.filter={},l.prototype.formula={linear:function(t){return t}},f=l.prototype.formula,r(l,{now:v,each:n,tweenProps:o,tweenProp:a,applyFilter:u,shallowCopy:r,defaults:i,composeEasingObject:c}),t.Tweenable=l,l}() !function(){e.shallowCopy(e.prototype.formula,{easeInQuad:function(t){return Math.pow(t,2)},easeOutQuad:function(t){return-(Math.pow(t-1,2)-1)},easeInOutQuad:function(t){return(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2)},easeInCubic:function(t){return Math.pow(t,3)},easeOutCubic:function(t){return Math.pow(t-1,3)+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)},easeInQuart:function(t){return Math.pow(t,4)},easeOutQuart:function(t){return-(Math.pow(t-1,4)-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},easeInQuint:function(t){return Math.pow(t,5)},easeOutQuint:function(t){return Math.pow(t-1,5)+1},easeInOutQuint:function(t){return(t/=.5)<1?.5*Math.pow(t,5):.5*(Math.pow(t-2,5)+2)},easeInSine:function(t){return-Math.cos(t*(Math.PI/2))+1},easeOutSine:function(t){return Math.sin(t*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:-Math.pow(2,-10*t)+1},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-Math.pow(t-1,2))},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInBack:function(t){var e=1.70158 return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158 return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158 return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},elastic:function(t){return-1*Math.pow(4,-8*t)*Math.sin((6*t-1)*(2*Math.PI)/2)+1},swingFromTo:function(t){var e=1.70158 return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},swingFrom:function(t){var e=1.70158 return t*t*((e+1)*t-e)},swingTo:function(t){var e=1.70158 return(t-=1)*t*((e+1)*t+e)+1},bounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bouncePast:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?2-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?2-(7.5625*(t-=2.25/2.75)*t+.9375):2-(7.5625*(t-=2.625/2.75)*t+.984375)},easeFromTo:function(t){return(t/=.5)<1?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},easeFrom:function(t){return Math.pow(t,4)},easeTo:function(t){return Math.pow(t,.25)}})}(),function(){function t(t,e,n,r,i,o){function a(t){return((h*t+p)*t+g)*t}function u(t){return((m*t+v)*t+w)*t}function s(t){return(3*h*t+2*p)*t+g}function c(t){return 1/(200*t)}function l(t,e){return u(d(t,e))}function f(t){return t>=0?t:0-t}function d(t,e){var n,r,i,o,u,c for(i=t,c=0;c<8;c++){if(o=a(i)-t,f(o)r)return r for(;no?n=i:r=i,i=.5*(r-n)+n}return i}var h=0,p=0,g=0,m=0,v=0,w=0 return g=3*e,p=3*(r-e)-g,h=1-g-p,w=3*n,v=3*(i-n)-w,m=1-w-v,l(t,c(o))}function n(e,n,r,i){return function(o){return t(o,e,n,r,i,1)}}e.setBezierFunction=function(t,r,i,o,a){var u=n(r,i,o,a) return u.x1=r,u.y1=i,u.x2=o,u.y2=a,e.prototype.formula[t]=u},e.unsetBezierFunction=function(t){delete e.prototype.formula[t]}}(),function(){function t(t,n,r,i,o){return e.tweenProps(i,n,t,r,1,0,o)}var n=new e n._filterArgs=[],e.interpolate=function(r,i,o,a){var u=e.shallowCopy({},r),s=e.composeEasingObject(r,a||"linear") n.set({}) var c=n._filterArgs c.length=0,c[0]=u,c[1]=r,c[2]=i,c[3]=s,e.applyFilter(n,"tweenCreated"),e.applyFilter(n,"beforeTween") var l=t(r,u,i,o,s) return e.applyFilter(n,"afterTween"),l}}(),function(t){function e(t,e){M.length=0 var n,r=t.length for(n=0;n