You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
7.5 KiB
1 lines
7.5 KiB
define(["exports","jquery","./util"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(){return f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},f.apply(this,arguments)}function g(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function h(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function i(a,b,c){return b&&h(a.prototype,b),c&&h(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var j=d(b),k=d(c),l=function(a){var b="carousel",c="4.0.0",d="bs.carousel",h=".".concat(d),j=".data-api",l=a.fn[b],m=600,n=37,o=39,p=500,q={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0},r={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean"},s={NEXT:"next",PREV:"prev",LEFT:"left",RIGHT:"right"},t={SLIDE:"slide".concat(h),SLID:"slid".concat(h),KEYDOWN:"keydown".concat(h),MOUSEENTER:"mouseenter".concat(h),MOUSELEAVE:"mouseleave".concat(h),TOUCHEND:"touchend".concat(h),LOAD_DATA_API:"load".concat(h).concat(j),CLICK_DATA_API:"click".concat(h).concat(j)},u={CAROUSEL:"carousel",ACTIVE:"active",SLIDE:"slide",RIGHT:"carousel-item-right",LEFT:"carousel-item-left",NEXT:"carousel-item-next",PREV:"carousel-item-prev",ITEM:"carousel-item"},v={ACTIVE:".active",ACTIVE_ITEM:".active.carousel-item",ITEM:".carousel-item",NEXT_PREV:".carousel-item-next, .carousel-item-prev",INDICATORS:".carousel-indicators",DATA_SLIDE:"[data-slide], [data-slide-to]",DATA_RIDE:'[data-ride="carousel"]'},w=function(){function j(b,c){g(this,j),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this._config=this._getConfig(c),this._element=a(b)[0],this._indicatorsElement=a(this._element).find(v.INDICATORS)[0],this._addEventListeners()}return i(j,[{key:"next",value:function(){this._isSliding||this._slide(s.NEXT)}},{key:"nextWhenVisible",value:function(){!document.hidden&&a(this._element).is(":visible")&&"hidden"!==a(this._element).css("visibility")&&this.next()}},{key:"prev",value:function(){this._isSliding||this._slide(s.PREV)}},{key:"pause",value:function(b){b||(this._isPaused=!0),a(this._element).find(v.NEXT_PREV)[0]&&k["default"].supportsTransitionEnd()&&(k["default"].triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}},{key:"cycle",value:function(a){a||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}},{key:"to",value:function(b){var c=this;this._activeElement=a(this._element).find(v.ACTIVE_ITEM)[0];var d=this._getItemIndex(this._activeElement);if(!(b>this._items.length-1||b<0)){if(this._isSliding)return void a(this._element).one(t.SLID,function(){return c.to(b)});if(d===b)return this.pause(),void this.cycle();var e=b>d?s.NEXT:s.PREV;this._slide(e,this._items[b])}}},{key:"dispose",value:function(){a(this._element).off(h),a.removeData(this._element,d),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null}},{key:"_getConfig",value:function(a){return a=f({},q,a),k["default"].typeCheckConfig(b,a,r),a}},{key:"_addEventListeners",value:function(){var b=this;this._config.keyboard&&a(this._element).on(t.KEYDOWN,function(a){return b._keydown(a)}),"hover"===this._config.pause&&(a(this._element).on(t.MOUSEENTER,function(a){return b.pause(a)}).on(t.MOUSELEAVE,function(a){return b.cycle(a)}),"ontouchstart"in document.documentElement&&a(this._element).on(t.TOUCHEND,function(){b.pause(),b.touchTimeout&&clearTimeout(b.touchTimeout),b.touchTimeout=setTimeout(function(a){return b.cycle(a)},p+b._config.interval)}))}},{key:"_keydown",value:function(a){if(!/input|textarea/i.test(a.target.tagName))switch(a.which){case n:a.preventDefault(),this.prev();break;case o:a.preventDefault(),this.next()}}},{key:"_getItemIndex",value:function(b){return this._items=a.makeArray(a(b).parent().find(v.ITEM)),this._items.indexOf(b)}},{key:"_getItemByDirection",value:function(a,b){var c=a===s.NEXT,d=a===s.PREV,e=this._getItemIndex(b),f=this._items.length-1,g=d&&0===e||c&&e===f;if(g&&!this._config.wrap)return b;var h=a===s.PREV?-1:1,i=(e+h)%this._items.length;return i===-1?this._items[this._items.length-1]:this._items[i]}},{key:"_triggerSlideEvent",value:function(b,c){var d=this._getItemIndex(b),e=this._getItemIndex(a(this._element).find(v.ACTIVE_ITEM)[0]),f=a.Event(t.SLIDE,{relatedTarget:b,direction:c,from:e,to:d});return a(this._element).trigger(f),f}},{key:"_setActiveIndicatorElement",value:function(b){if(this._indicatorsElement){a(this._indicatorsElement).find(v.ACTIVE).removeClass(u.ACTIVE);var c=this._indicatorsElement.children[this._getItemIndex(b)];c&&a(c).addClass(u.ACTIVE)}}},{key:"_slide",value:function(b,c){var d,e,f,g=this,h=a(this._element).find(v.ACTIVE_ITEM)[0],i=this._getItemIndex(h),j=c||h&&this._getItemByDirection(b,h),l=this._getItemIndex(j),n=Boolean(this._interval);if(b===s.NEXT?(d=u.LEFT,e=u.NEXT,f=s.LEFT):(d=u.RIGHT,e=u.PREV,f=s.RIGHT),j&&a(j).hasClass(u.ACTIVE))return void(this._isSliding=!1);var o=this._triggerSlideEvent(j,f);if(!o.isDefaultPrevented()&&h&&j){this._isSliding=!0,n&&this.pause(),this._setActiveIndicatorElement(j);var p=a.Event(t.SLID,{relatedTarget:j,direction:f,from:i,to:l});k["default"].supportsTransitionEnd()&&a(this._element).hasClass(u.SLIDE)?(a(j).addClass(e),k["default"].reflow(j),a(h).addClass(d),a(j).addClass(d),a(h).one(k["default"].TRANSITION_END,function(){a(j).removeClass("".concat(d," ").concat(e)).addClass(u.ACTIVE),a(h).removeClass("".concat(u.ACTIVE," ").concat(e," ").concat(d)),g._isSliding=!1,setTimeout(function(){return a(g._element).trigger(p)},0)}).emulateTransitionEnd(m)):(a(h).removeClass(u.ACTIVE),a(j).addClass(u.ACTIVE),this._isSliding=!1,a(this._element).trigger(p)),n&&this.cycle()}}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=a(this).data(d),g=f({},q,a(this).data());"object"===e(b)&&(g=f({},g,b));var h="string"==typeof b?b:g.slide;if(c||(c=new j(this,g),a(this).data(d,c)),"number"==typeof b)c.to(b);else if("string"==typeof h){if("undefined"==typeof c[h])throw new TypeError('No method named "'.concat(h,'"'));c[h]()}else g.interval&&(c.pause(),c.cycle())})}},{key:"_dataApiClickHandler",value:function(b){var c=k["default"].getSelectorFromElement(this);if(c){var e=a(c)[0];if(e&&a(e).hasClass(u.CAROUSEL)){var g=f({},a(e).data(),a(this).data()),h=this.getAttribute("data-slide-to");h&&(g.interval=!1),j._jQueryInterface.call(a(e),g),h&&a(e).data(d).to(h),b.preventDefault()}}}},{key:"VERSION",get:function(){return c}},{key:"Default",get:function(){return q}}]),j}();return a(document).on(t.CLICK_DATA_API,v.DATA_SLIDE,w._dataApiClickHandler),a(window).on(t.LOAD_DATA_API,function(){a(v.DATA_RIDE).each(function(){var b=a(this);w._jQueryInterface.call(b,b.data())})}),a.fn[b]=w._jQueryInterface,a.fn[b].Constructor=w,a.fn[b].noConflict=function(){return a.fn[b]=l,w._jQueryInterface},w}(j["default"]);a["default"]=l});
|