PageSourceSearch

http://otterbeckbuilders.com/js/jquery.carousel.min.js

js otterbeckbuilders.com collected 2026-09-25 23:53:17 UTC 12,460 bytes, 8 lines download raw bytes

1/**
2  jQuery Carousel Plugin by Thomas Jaggi (2013) - http://github.com/backflip/jquery-carousel/
3  MIT/GPL2 Licensed
4  
5  Modified by Emerald
6*/
7
8(function(m,q,d,x){var v={animation:{duration:400,step:1},behavior:{circular:!1,autoplay:0,pauseAutoplayOnHover:!0,keyboardNav:!0},elements:{prevNext:!0,handles:!1,counter:!1},events:{start:!1,stop:!1},initialSlide:0,text:{next:"",prev:"",counter:"%current% of %total%",handle:"%index%"},touch:{enabled:!0,thresholds:{speed:0.4,distance:0.3}},visibleSlides:1},e={getTransitionProperty:function(){var a="transition",b,c=["Moz","ms","O","Webkit"],f=(q.body||q.documentElement).style;if("string"===typeof f[a])return a; for(var a=a.charAt(0).toUpperCase()+a.substr(1),d=0;d<c.length;d++)if(b=c[d]+a,"string"===typeof f[b])return b;return!1},getTransitionEndEvent:function(){return{transition:"transitionend",MozTransition:"transitionend",msTransition:"msTransitionEnd",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd"}[e.getTransitionProperty()]||!1},getNamespacedEvents:function(a){a=a.split(" ");for(var b=0;b<a.length;b++)a[b]+=".carousel";return a.join(" ")},enableButton:function(a){a.removeClass("state-disabled").removeAttr("aria-disabled").attr("tabindex", 0)},disableButton:function(a){a.addClass("state-disabled").attr("aria-disabled",!0).attr("tabindex",-1)}},r="ontouchstart"in m,h=e.getTransitionProperty(),n=e.getNamespacedEvents(r?"touchstart":"click keydown"),k=!1,w=0,s=function(a,b){this.$dom={slider:d(a),slides:d(a).children(),container:d(a).parent().parent(),frame:d(a).parent(),navContainer:d('<div class="carousel-nav" aria-hidden="true" />'),prev:d('<span class="carousel-prev" role="button" tabindex="0" />'),next:d('<span class="carousel-next" role="button" tabindex="0" />'), counter:d('<div class="carousel-counter" aria-hidden="true" />'),handlesContainer:d('<div class="carousel-handles" aria-hidden="true" />'),handles:null,handle:d('<span class="carousel-handle" role="button" tabindex="0" />')};this.props={current:0,total:0,visible:0};this.state={enabled:!1,animating:!1};this.settings=d.extend(!0,{},b,this.$dom.slider.data("carousel-options"))};s.prototype={init:function(){var a=this,b=this.$dom,c=null,f;if(this.$dom.slider.data("carousel")||0===this.$dom.slider.length)return this; this.index=w++;this.settings=d.extend(!0,{},v,this.settings);f=this._getStyles(b.slider);b.slider.data("carousel-css",f);b.slides.each(function(){var b=d(this),c=a._getStyles(b);b.data("carousel-css",c)});b.slider.addClass("carousel-slider");this.settings.elements.prevNext&&(b.prev.appendTo(b.navContainer).text(this.settings.text.prev),b.next.appendTo(b.navContainer).text(this.settings.text.next),b.navContainer.appendTo(b.container),b.nav=b.prev.add(b.next));this.settings.elements.counter&&b.counter.appendTo(b.container); this.settings.elements.handles&&b.handlesContainer.appendTo(b.container);b.slides.addClass("carousel-slide");this.settings.behavior.circular&&b.slides.each(function(a){d(this).data("carousel-index",a)});this.update();d(m).on(e.getNamespacedEvents("resize")+this.index,d.proxy(function(){c&&clearTimeout(c);c=setTimeout(d.proxy(function(){this.resize()},this),100)},this));b.slider.data("carousel",this);return this},update:function(a){d.extend(!0,this.settings,a);this.$dom.slides=this.$dom.slides.parent().children(); this.$dom.slider.addClass("initiated");this.props.total=this.$dom.slides.length;this.props.current=this.settings.initialSlide;this.props.visible=this._getVisibleSlides();this.settings.elements.handles&&(this.$dom.handlesContainer.html(this._getHandles()),this.$dom.handles=this.$dom.handlesContainer.children());this.resize();this.disable();this.enable()},resize:function(){this.$dom.frame.width();var a=this.$dom.slides.width()+parseInt(this.$dom.slides.css("padding-right"));this.$dom.slider.width(this.props.total* a).height("auto");this.$dom.frame.height(void 0);this.goTo(this.props.current,!0);this.props.total>this.props.visible?this.$dom.navContainer.css("display","block"):this.$dom.navContainer.css("display","none")},enable:function(){var a=this;if(!(this.state.enabled||this.props.visible>this.props.total)){if(this.settings.elements.prevNext)this.$dom.nav.on(n,function(b){var c=d(this),f,e;c.hasClass("state-disabled")||(f=c.is(a.$dom.next)?1:-1,e=f*a.settings.animation.step+a.props.current,a._handleButtonEvents(b, c,function(){a.goTo(e)}))});if(this.settings.elements.handles)this.$dom.handles.on(n,function(b){var c=d(this),f=c.index(),e=a._getSlideIndex(f);a._handleButtonEvents(b,c,function(){a.goTo(e)})});this.settings.touch.enabled&&r&&this._touchEnable();if(this.settings.behavior.keyboardNav)this.$dom.container.on(e.getNamespacedEvents("keydown"),d.proxy(function(b){var c=d(b.target).get(0).nodeName.toLowerCase(),f=!1;-1!==d.inArray(c,["input","textarea"])||b.metaKey||b.ctrlKey||(c=b.keyCode||b.which,-1!== d.inArray(c,[37,80])?(this.prev(),this.$dom.prev.focus(),f=!0):-1!==d.inArray(c,[39,78])?(this.next(),this.$dom.next.focus(),f=!0):47<c&&58>c&&(f=c-49,c=a._getSlideIndex(f),this.goTo(c),this.settings.elements.handles&&this.$dom.handles.eq(f).focus(),f=!0));f&&(this._autoplayDisable(),b.preventDefault())},this));this.settings.behavior.autoplay&&(this._autoplayEnable(),this.settings.behavior.pauseAutoplayOnHover&&(this.$dom.container.on(e.getNamespacedEvents("mouseenter"),d.proxy(function(a){this._autoplayDisable()}, this)),this.$dom.container.on(e.getNamespacedEvents("mouseleave"),d.proxy(function(a){this._autoplayEnable()},this))));this.state.enabled=!0;this._updateNav()}},disable:function(a){this.state.enabled&&(this.settings.elements.prevNext&&this.$dom.nav.off(n),this.settings.elements.handles&&this.$dom.handles.off(n),this.settings.touch.enabled&&r&&this._touchDisable(),this.settings.behavior.keyboardNav&&this.$dom.container.off(e.getNamespacedEvents("keydown")),this.settings.behavior.autoplay&&this._autoplayDisable(), this.state.enabled=!1,this._updateNav())},goTo:function(a,b,c){var d=this,p=this._getValidatedTarget(a);a=this._getTargetPosition(p);var t=b?0:c?0.7*this.settings.animation.duration:this.settings.animation.duration,k=function(){d.settings.events.stop&&d.settings.events.stop(p);d.state.animating=!1},g,u;b?this.$dom.slider.css(a):(this.state.animating=!0,this.settings.events.start&&this.settings.events.start(p),h?(b=c?"ease-out":"ease-in-out",g=e.getNamespacedEvents(e.getTransitionEndEvent()),u=this.$dom.slider.css(h), this.$dom.slider.css(h,"left "+t/1E3+"s "+b),this.$dom.slider.css(a),this.$dom.slider.on(g,function(){d.$dom.slider.off(g);d.$dom.slider.css(h,u);k()})):this.$dom.slider.animate(a,t,function(){k()}));this.props.current=p;this._updateNav()},next:function(){this.goTo(this.props.current+this.settings.animation.step)},prev:function(){this.goTo(this.props.current-this.settings.animation.step)},destroy:function(){var a=this.$dom,b=a.slider.data("carousel-css");a.slider.removeClass("carousel-slider").removeData("carousel").removeData("carousel-css").insertAfter(a.container).css(b); a.slides.removeClass("carousel-slide").removeData("carousel-index").each(function(){var a=d(this),b=a.data("carousel-css");a.css(b)}).removeData("carousel-css");a.container.remove();this.state.enabled=!1;this.props.current=0;d(m).off(e.getNamespacedEvents("resize")+this.index)},_autoplayEnable:function(){this.autoplay=setInterval(d.proxy(function(){this.next()},this),this.settings.behavior.autoplay)},_autoplayDisable:function(){clearInterval(this.autoplay);this.autoplay=null},_handleButtonEvents:function(a, b,c){switch(a.type){case "keydown":a.metaKey||a.ctrlKey||-1===d.inArray(a.keyCode||a.which,[13,32])||(c(),a.preventDefault());break;case "touchstart":k=!1;b.on("touchmove.carousel",function(){k=!0});b.on("touchend.carousel",function(){b.off("touchmove.carousel");b.off("touchend.carousel");k||c()});break;default:c()}this.settings.behavior.autoplay&&this._autoplayDisable()},_getHandles:function(){for(var a=q.createDocumentFragment(),b=0;b<this.props.total;b++){var c=this.settings.text.handle.replace("%index%", b+1),c=this.$dom.handle.clone().text(c).get(0);a.appendChild(c)}return d(a)},_getHighestSlide:function(){var a=0;this.$dom.slides.each(function(){var b=d(this).css("min-height",0).height();b>a&&(a=b)});return a},_getSlideIndex:function(a,b){this.settings.behavior.circular&&this.$dom.slides.each(function(){var c=d(this),f=c.index(),c=c.data("carousel-index");if(a===(b?f:c))return a=f,!1});return a},_getStyles:function(a){for(var b=["height","left","min-height","top","width"],c={},d=0;d<b.length;d++)c[b[d]]= a.css(b[d]);h&&(b=h.charAt(0).toLowerCase()+h.substr(1),c[b]=a.css(b));return c},_getTargetPosition:function(a){var b=this.$dom.slides.width()+parseInt(this.$dom.slides.css("padding-right")),c={};c.left=-a*b;return c}
8,_getValidatedTarget:function(a){if(!this.settings.behavior.circular)0>a?a=0:a>=this.props.total-this.props.visible&&(a=this.props.total-this.props.visible);else if(0>a){if(this._shiftSlides(this.props.total+a,-1))return 0}else if(this.props.total>this.props.visible&&a>this.props.total- this.props.visible){var b=a-1-(this.props.total-this.props.visible);if(this._shiftSlides(b,1))return a-(b+1)}return a},_getVisibleSlides:function(){if(0<this.settings.visibleSlides)return this.settings.visibleSlides;var a=0,b=this.$dom.frame.width();this.$dom.slides.each(function(){var b=d(this).width();b>a&&(a=b)});return Math.round(b/a)},_shiftSlides:function(a,b){var c=this.$dom.slides.filter(-1===b?":gt("+(a-1)+")":":lt("+(a+1)+")");if(0<c.length){var d=this.$dom.slides.width(),e=this.$dom.slider.position(), k={};k.left=e.left+b*c.length*d;-1===b?c.prependTo(this.$dom.slider):c.appendTo(this.$dom.slider);this.$dom.slides=this.$dom.slider.children();this.$dom.slider.css(k);return!0}return!1},_touchEnable:function(){function a(){return{x:c.end.x-c.start.x,y:c.end.y-c.start.y}}var b=this,c={start:{x:0,y:0},end:{x:0,y:0}},d=0,e=0,h=b.settings.touch.thresholds.distance*b.$dom.frame.width(),m=b.settings.touch.thresholds.speed*b.$dom.frame.width(),g={top:0,left:0};this.$dom.frame.on({"touchstart.carousel":function(a){a= a.originalEvent.targetTouches[0];c.start.x=a.pageX;c.start.y=a.pageY;g=b.$dom.slider.position();d=(new Date).getTime();k=!1},"touchmove.carousel":function(d){var e=d.originalEvent.targetTouches[0],f=0,h={};c.end.x=e.pageX;c.end.y=e.pageY;f=a();e=b.$dom.frame.width()-b.$dom.slider.width()+parseInt(b.$dom.slides.css("padding-right"));Math.abs(f.x)>Math.abs(f.y)&&!(0<=g.left&&c.end.x>c.start.x||g.left<=e&&c.end.x<c.start.x)&&(e=g.left,h.left=e+f.x,b.$dom.slider.css(h),k=!0,d.preventDefault())},"touchend.carousel":function(c){if(k){var l= a(),g=b.props.current;if(Math.abs(l.x)>Math.abs(l.y)){e=(new Date).getTime();c=Math.abs(l.x)/(e-d)*1E3;if(Math.abs(l.x)>h||c>m){var n=b.$dom.slides.width(),g=0<l.x?-1:1,l=Math.abs(Math.round(l.x/n));1>l&&c>m&&(l=1);g=b.props.current+g*l}b.goTo(g,!1,!0);b.settings.behavior.autoplay&&b._autoplayDisable()}}}})},_touchDisable:function(){this.$dom.frame.off(e.getNamespacedEvents("touchstart touchmove touchend"))},_updateNav:function(){if(this.state.enabled){if(this.settings.elements.prevNext&&(e.enableButton(this.$dom.prev), e.enableButton(this.$dom.next),this.settings.behavior.circular||(0===this.props.current?e.disableButton(this.$dom.prev):e.enableButton(this.$dom.prev),this.props.current===this.props.total-this.props.visible?e.disableButton(this.$dom.next):e.enableButton(this.$dom.next))),this.settings.elements.handles){var a=this._getSlideIndex(this.props.current,!0),a=0<a?":gt("+(a-1)+"):lt("+this.props.visible+")":":lt("+(a+this.props.visible)+")";e.enableButton(this.$dom.handles);this.$dom.handles.removeClass("state-current"); this.$dom.handles.filter(a).addClass("state-current")}}else this.settings.elements.prevNext&&(e.disableButton(this.$dom.prev),e.disableButton(this.$dom.next)),this.settings.elements.handles&&e.disableButton(this.$dom.handles);if(this.settings.elements.counter){var a=this._getSlideIndex(this.props.current,!0)+1,b=a+(this.props.visible-1);1<this.props.visible&&(b>this.props.total&&(b=this.props.total),a+="-"+b);a=this.settings.text.counter.replace("%current%",a).replace("%total%",this.props.total); this.$dom.counter.text(a)}}};d.fn.carousel=function(a){var b=arguments;return this.each(function(){var c=d(this).data("carousel");c?"object"===typeof a?c.update.apply(c,b):c[a].apply(c,Array.prototype.slice.call(b,1)):(new s(this,a)).init()})};m.Carousel=s})(window,document,jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.