UNPKG

foundation-sites

Version:

The most advanced responsive front-end framework in the world.

3 lines (2 loc) 10.8 kB
((t,e)=>{"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./foundation.core"),require("jquery"),require("./foundation.util.keyboard"),require("./foundation.util.motion"),require("./foundation.util.timer"),require("./foundation.util.imageLoader"),require("./foundation.util.touch")):"function"==typeof define&&define.amd?define(["./foundation.core","jquery","./foundation.util.keyboard","./foundation.util.motion","./foundation.util.timer","./foundation.util.imageLoader","./foundation.util.touch"],e):"object"==typeof exports?exports.__FOUNDATION_EXTERNAL__=e(require("./foundation.core"),require("jquery"),require("./foundation.util.keyboard"),require("./foundation.util.motion"),require("./foundation.util.timer"),require("./foundation.util.imageLoader"),require("./foundation.util.touch")):(t.__FOUNDATION_EXTERNAL__=t.__FOUNDATION_EXTERNAL__||{},t.__FOUNDATION_EXTERNAL__["foundation.orbit"]=e(t.__FOUNDATION_EXTERNAL__["foundation.core"],t.jQuery,t.__FOUNDATION_EXTERNAL__["foundation.util.keyboard"],t.__FOUNDATION_EXTERNAL__["foundation.util.motion"],t.__FOUNDATION_EXTERNAL__["foundation.util.timer"],t.__FOUNDATION_EXTERNAL__["foundation.util.imageLoader"],t.__FOUNDATION_EXTERNAL__["foundation.util.touch"]))})(self,function(e,i,n,o,s,r,a){return u={"./js/foundation.orbit.js":function(t,e,i){i.r(e),i.d(e,{Orbit:function(){return n}});var e=i("jquery"),s=i.n(e),o=i("./foundation.util.keyboard"),f=i("./foundation.util.motion"),r=i("./foundation.util.timer"),a=i("./foundation.util.imageLoader"),l=i("./foundation.core"),u=i("./foundation.util.touch");function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(t=>(t=((t,e)=>{if("object"!=c(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);if("object"!=c(i=i.call(t,e||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==c(t)?t:t+""))(n.key),n)}}function h(t,e,i){e=b(e);var n=t,e=p()?Reflect.construct(e,i||[],b(t).constructor):e.apply(t,i);if(!e||"object"!=c(e)&&"function"!=typeof e){if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(e=n))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(p=function(){return!!t})()}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){return(m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var n=(t=>{function i(){var t=this,e=i;if(t instanceof e)return h(this,i,arguments);throw new TypeError("Cannot call a class as a function")}var e,n=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&m(n,t),n=i,(t=[{key:"_setup",value:function(t,e){this.$element=t,this.options=s().extend({},i.defaults,this.$element.data(),e),this.className="Orbit",u.Touch.init(s()),this._init(),o.Keyboard.register("Orbit",{ltr:{ARROW_RIGHT:"next",ARROW_LEFT:"previous"},rtl:{ARROW_LEFT:"next",ARROW_RIGHT:"previous"}})}},{key:"_init",value:function(){this._reset(),this.$wrapper=this.$element.find(".".concat(this.options.containerClass)),this.$slides=this.$element.find(".".concat(this.options.slideClass));var t=this.$element.find("img"),e=this.$slides.filter(".is-active"),i=this.$element[0].id||(0,l.GetYoDigits)(6,"orbit");this.$element.attr({"data-resize":i,id:i}),e.length||this.$slides.eq(0).addClass("is-active"),this.options.useMUI||this.$slides.addClass("no-motionui"),t.length?(0,a.onImagesLoaded)(t,this._prepareForOrbit.bind(this)):this._prepareForOrbit(),this.options.bullets&&this._loadBullets(),this._events(),this.options.autoPlay&&1<this.$slides.length&&this.geoSync(),this.options.accessible&&this.$wrapper.attr("tabindex",0)}},{key:"_loadBullets",value:function(){this.$bullets=this.$element.find(".".concat(this.options.boxOfBullets)).find("button")}},{key:"geoSync",value:function(){var t=this;this.timer=new r.Timer(this.$element,{duration:this.options.timerDelay,infinite:!1},function(){t.changeSlide(!0)}),this.timer.start()}},{key:"_prepareForOrbit",value:function(){this._setWrapperHeight()}},{key:"_setWrapperHeight",value:function(t){var e,i=0,n=0,o=this;this.$slides.each(function(){e=this.getBoundingClientRect().height,s()(this).attr("data-slide",n),/mui/g.test(s()(this)[0].className)||o.$slides.filter(".is-active")[0]===o.$slides.eq(n)[0]||s()(this).css({display:"none"}),i=i<e?e:i,n++}),n===this.$slides.length&&(this.$wrapper.css({height:i}),t)&&t(i)}},{key:"_setSlideHeight",value:function(t){this.$slides.each(function(){s()(this).css("max-height",t)})}},{key:"_events",value:function(){var n=this;this.$element.off(".resizeme.zf.trigger").on({"resizeme.zf.trigger":this._prepareForOrbit.bind(this)}),1<this.$slides.length&&(this.options.swipe&&this.$slides.off("swipeleft.zf.orbit swiperight.zf.orbit").on("swipeleft.zf.orbit",function(t){t.preventDefault(),n.changeSlide(!0)}).on("swiperight.zf.orbit",function(t){t.preventDefault(),n.changeSlide(!1)}),this.options.autoPlay&&(this.$slides.on("click.zf.orbit",function(){n.$element.data("clickedOn",!n.$element.data("clickedOn")),n.timer[n.$element.data("clickedOn")?"pause":"start"]()}),this.options.pauseOnHover)&&this.$element.on("mouseenter.zf.orbit",function(){n.timer.pause()}).on("mouseleave.zf.orbit",function(){n.$element.data("clickedOn")||n.timer.start()}),this.options.navButtons&&this.$element.find(".".concat(this.options.nextClass,", .").concat(this.options.prevClass)).attr("tabindex",0).on("click.zf.orbit touchend.zf.orbit",function(t){t.preventDefault(),n.changeSlide(s()(this).hasClass(n.options.nextClass))}),this.options.bullets&&this.$bullets.on("click.zf.orbit touchend.zf.orbit",function(){if(/is-active/g.test(this.className))return!1;var t=s()(this).data("slide"),e=t>n.$slides.filter(".is-active").data("slide"),i=n.$slides.eq(t);n.changeSlide(e,i,t)}),this.options.accessible)&&this.$wrapper.add(this.$bullets).on("keydown.zf.orbit",function(t){o.Keyboard.handleKey(t,"Orbit",{next:function(){n.changeSlide(!0)},previous:function(){n.changeSlide(!1)},handled:function(){s()(t.target).is(n.$bullets)&&n.$bullets.filter(".is-active").focus()}})})}},{key:"_reset",value:function(){void 0!==this.$slides&&1<this.$slides.length&&(this.$element.off(".zf.orbit").find("*").off(".zf.orbit"),this.options.autoPlay&&this.timer.restart(),this.$slides.each(function(t){s()(t).removeClass("is-active is-active is-in").removeAttr("aria-live").hide()}),this.$slides.first().addClass("is-active").show(),this.$element.trigger("slidechange.zf.orbit",[this.$slides.first()]),this.options.bullets)&&this._updateBullets(0)}},{key:"changeSlide",value:function(t,e,i){if(this.$slides){var n=this.$slides.filter(".is-active").eq(0);if(/mui/g.test(n[0].className))return!1;var o=this.$slides.first(),s=this.$slides.last(),r=t?"Right":"Left",a=t?"Left":"Right",l=this,u=e||(t?!this.options.infiniteWrap||n.next(".".concat(this.options.slideClass)).length?n.next(".".concat(this.options.slideClass)):o:!this.options.infiniteWrap||n.prev(".".concat(this.options.slideClass)).length?n.prev(".".concat(this.options.slideClass)):s);u.length&&(this.$element.trigger("beforeslidechange.zf.orbit",[n,u]),this.options.bullets&&(i=i||this.$slides.index(u),this._updateBullets(i)),this.options.useMUI&&!this.$element.is(":hidden")?(f.Motion.animateIn(u.addClass("is-active"),this.options["animInFrom".concat(r)],function(){u.css({display:"block"}).attr("aria-live","polite")}),f.Motion.animateOut(n.removeClass("is-active"),this.options["animOutTo".concat(a)],function(){n.removeAttr("aria-live"),l.options.autoPlay&&!l.timer.isPaused&&l.timer.restart()})):(n.removeClass("is-active is-in").removeAttr("aria-live").hide(),u.addClass("is-active is-in").attr("aria-live","polite").show(),this.options.autoPlay&&!this.timer.isPaused&&this.timer.restart()),this.$element.trigger("slidechange.zf.orbit",[u]))}}},{key:"_updateBullets",value:function(t){var e,i=this.$bullets.filter(".is-active"),n=this.$bullets.not(".is-active"),t=this.$bullets.eq(t),o=(i.removeClass("is-active").blur(),t.addClass("is-active"),i.children("[data-slide-active-label]").last());o.length||(e=i.children("span"),n.toArray().map(function(t){return s()(t).children("span").length}).every(function(t){return t<e.length})&&(o=e.last()).attr("data-slide-active-label","")),o.length&&(o.detach(),t.append(o))}},{key:"_destroy",value:function(){this.$element.off(".zf.orbit").find("*").off(".zf.orbit").end().hide()}}])&&d(n.prototype,t),e&&d(n,e),Object.defineProperty(n,"prototype",{writable:!1}),n})(l.Plugin);n.defaults={bullets:!0,navButtons:!0,animInFromRight:"slide-in-right",animOutToRight:"slide-out-right",animInFromLeft:"slide-in-left",animOutToLeft:"slide-out-left",autoPlay:!0,timerDelay:5e3,infiniteWrap:!0,swipe:!0,pauseOnHover:!0,accessible:!0,containerClass:"orbit-container",slideClass:"orbit-slide",boxOfBullets:"orbit-bullets",nextClass:"orbit-next",prevClass:"orbit-previous",useMUI:!0}},"./foundation.core":function(t){t.exports=e},"./foundation.util.imageLoader":function(t){t.exports=r},"./foundation.util.keyboard":function(t){t.exports=n},"./foundation.util.motion":function(t){t.exports=o},"./foundation.util.timer":function(t){t.exports=s},"./foundation.util.touch":function(t){t.exports=a},jquery:function(t){t.exports=i}},f={},l.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return l.d(e,{a:e}),e},l.d=function(t,e){for(var i in e)l.o(e,i)&&!l.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},d={},(l.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})(d),l.d(d,{Foundation:function(){return t.Foundation},Orbit:function(){return c.Orbit}}),t=l("./foundation.core"),c=l("./js/foundation.orbit.js"),t.Foundation.plugin(c.Orbit,"Orbit"),d;function l(t){var e=f[t];return void 0!==e||(e=f[t]={exports:{}},u[t](e,e.exports,l)),e.exports}var u,f,t,c,d}); //# sourceMappingURL=foundation.orbit.min.js.map