Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/dist/carousel.js')
-rw-r--r--js/dist/carousel.js872
1 files changed, 464 insertions, 408 deletions
diff --git a/js/dist/carousel.js b/js/dist/carousel.js
index 4cde937bd8..766f7708c7 100644
--- a/js/dist/carousel.js
+++ b/js/dist/carousel.js
@@ -1,511 +1,567 @@
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
+ typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
+ (global.Carousel = factory(global.jQuery,global.Util));
+}(this, (function ($,Util) { 'use strict';
+
+ $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
+ Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
+
+ function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+ }
+
+ function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+ return obj;
+ }
-function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+ function _objectSpread(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+ var ownKeys = Object.keys(source);
-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+ if (typeof Object.getOwnPropertySymbols === 'function') {
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
+ }));
+ }
+
+ ownKeys.forEach(function (key) {
+ _defineProperty(target, key, source[key]);
+ });
+ }
+
+ return target;
+ }
-/**
- * --------------------------------------------------------------------------
- * Bootstrap (v4.1.2): carousel.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * --------------------------------------------------------------------------
- */
-var Carousel = function ($) {
/**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
+ * --------------------------------------------------------------------------
+ * Bootstrap (v4.1.2): carousel.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * --------------------------------------------------------------------------
*/
- var NAME = 'carousel';
- var VERSION = '4.1.2';
- var DATA_KEY = 'bs.carousel';
- var EVENT_KEY = "." + DATA_KEY;
- var DATA_API_KEY = '.data-api';
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
-
- var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
-
- var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
-
- var Default = {
- interval: 5000,
- keyboard: true,
- slide: false,
- pause: 'hover',
- wrap: true
- };
- var DefaultType = {
- interval: '(number|boolean)',
- keyboard: 'boolean',
- slide: '(boolean|string)',
- pause: '(string|boolean)',
- wrap: 'boolean'
- };
- var Direction = {
- NEXT: 'next',
- PREV: 'prev',
- LEFT: 'left',
- RIGHT: 'right'
- };
- var Event = {
- SLIDE: "slide" + EVENT_KEY,
- SLID: "slid" + EVENT_KEY,
- KEYDOWN: "keydown" + EVENT_KEY,
- MOUSEENTER: "mouseenter" + EVENT_KEY,
- MOUSELEAVE: "mouseleave" + EVENT_KEY,
- TOUCHEND: "touchend" + EVENT_KEY,
- LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
- };
- var ClassName = {
- 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'
- };
- var Selector = {
- 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"]'
+
+ var Carousel = function ($$$1) {
/**
* ------------------------------------------------------------------------
- * Class Definition
+ * Constants
* ------------------------------------------------------------------------
*/
+ var NAME = 'carousel';
+ var VERSION = '4.1.2';
+ var DATA_KEY = 'bs.carousel';
+ var EVENT_KEY = "." + DATA_KEY;
+ var DATA_API_KEY = '.data-api';
+ var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
+ var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
+
+ var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
+
+ var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
+
+ var Default = {
+ interval: 5000,
+ keyboard: true,
+ slide: false,
+ pause: 'hover',
+ wrap: true
+ };
+ var DefaultType = {
+ interval: '(number|boolean)',
+ keyboard: 'boolean',
+ slide: '(boolean|string)',
+ pause: '(string|boolean)',
+ wrap: 'boolean'
+ };
+ var Direction = {
+ NEXT: 'next',
+ PREV: 'prev',
+ LEFT: 'left',
+ RIGHT: 'right'
+ };
+ var Event = {
+ SLIDE: "slide" + EVENT_KEY,
+ SLID: "slid" + EVENT_KEY,
+ KEYDOWN: "keydown" + EVENT_KEY,
+ MOUSEENTER: "mouseenter" + EVENT_KEY,
+ MOUSELEAVE: "mouseleave" + EVENT_KEY,
+ TOUCHEND: "touchend" + EVENT_KEY,
+ LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
+ CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
+ };
+ var ClassName = {
+ 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'
+ };
+ var Selector = {
+ 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"]'
+ /**
+ * ------------------------------------------------------------------------
+ * Class Definition
+ * ------------------------------------------------------------------------
+ */
- };
-
- var Carousel =
- /*#__PURE__*/
- function () {
- function Carousel(element, config) {
- this._items = null;
- this._interval = null;
- this._activeElement = null;
- this._isPaused = false;
- this._isSliding = false;
- this.touchTimeout = null;
- this._config = this._getConfig(config);
- this._element = $(element)[0];
- this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
-
- this._addEventListeners();
- } // Getters
+ };
+ var Carousel =
+ /*#__PURE__*/
+ function () {
+ function Carousel(element, config) {
+ this._items = null;
+ this._interval = null;
+ this._activeElement = null;
+ this._isPaused = false;
+ this._isSliding = false;
+ this.touchTimeout = null;
+ this._config = this._getConfig(config);
+ this._element = $$$1(element)[0];
+ this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
- var _proto = Carousel.prototype;
+ this._addEventListeners();
+ } // Getters
- // Public
- _proto.next = function next() {
- if (!this._isSliding) {
- this._slide(Direction.NEXT);
- }
- };
- _proto.nextWhenVisible = function nextWhenVisible() {
- // Don't call next when the page isn't visible
- // or the carousel or its parent isn't visible
- if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
- this.next();
- }
- };
+ var _proto = Carousel.prototype;
- _proto.prev = function prev() {
- if (!this._isSliding) {
- this._slide(Direction.PREV);
- }
- };
+ // Public
+ _proto.next = function next() {
+ if (!this._isSliding) {
+ this._slide(Direction.NEXT);
+ }
+ };
- _proto.pause = function pause(event) {
- if (!event) {
- this._isPaused = true;
- }
+ _proto.nextWhenVisible = function nextWhenVisible() {
+ // Don't call next when the page isn't visible
+ // or the carousel or its parent isn't visible
+ if (!document.hidden && $$$1(this._element).is(':visible') && $$$1(this._element).css('visibility') !== 'hidden') {
+ this.next();
+ }
+ };
- if (this._element.querySelector(Selector.NEXT_PREV)) {
- Util.triggerTransitionEnd(this._element);
- this.cycle(true);
- }
+ _proto.prev = function prev() {
+ if (!this._isSliding) {
+ this._slide(Direction.PREV);
+ }
+ };
- clearInterval(this._interval);
- this._interval = null;
- };
+ _proto.pause = function pause(event) {
+ if (!event) {
+ this._isPaused = true;
+ }
- _proto.cycle = function cycle(event) {
- if (!event) {
- this._isPaused = false;
- }
+ if (this._element.querySelector(Selector.NEXT_PREV)) {
+ Util.triggerTransitionEnd(this._element);
+ this.cycle(true);
+ }
- if (this._interval) {
clearInterval(this._interval);
this._interval = null;
- }
+ };
- if (this._config.interval && !this._isPaused) {
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
- }
- };
+ _proto.cycle = function cycle(event) {
+ if (!event) {
+ this._isPaused = false;
+ }
- _proto.to = function to(index) {
- var _this = this;
+ if (this._interval) {
+ clearInterval(this._interval);
+ this._interval = null;
+ }
- this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
+ if (this._config.interval && !this._isPaused) {
+ this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
+ }
+ };
- var activeIndex = this._getItemIndex(this._activeElement);
+ _proto.to = function to(index) {
+ var _this = this;
- if (index > this._items.length - 1 || index < 0) {
- return;
- }
+ this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
- if (this._isSliding) {
- $(this._element).one(Event.SLID, function () {
- return _this.to(index);
- });
- return;
- }
+ var activeIndex = this._getItemIndex(this._activeElement);
- if (activeIndex === index) {
- this.pause();
- this.cycle();
- return;
- }
+ if (index > this._items.length - 1 || index < 0) {
+ return;
+ }
- var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
+ if (this._isSliding) {
+ $$$1(this._element).one(Event.SLID, function () {
+ return _this.to(index);
+ });
+ return;
+ }
- this._slide(direction, this._items[index]);
- };
+ if (activeIndex === index) {
+ this.pause();
+ this.cycle();
+ return;
+ }
- _proto.dispose = function dispose() {
- $(this._element).off(EVENT_KEY);
- $.removeData(this._element, DATA_KEY);
- this._items = null;
- this._config = null;
- this._element = null;
- this._interval = null;
- this._isPaused = null;
- this._isSliding = null;
- this._activeElement = null;
- this._indicatorsElement = null;
- }; // Private
-
-
- _proto._getConfig = function _getConfig(config) {
- config = _objectSpread({}, Default, config);
- Util.typeCheckConfig(NAME, config, DefaultType);
- return config;
- };
+ var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
- _proto._addEventListeners = function _addEventListeners() {
- var _this2 = this;
+ this._slide(direction, this._items[index]);
+ };
- if (this._config.keyboard) {
- $(this._element).on(Event.KEYDOWN, function (event) {
- return _this2._keydown(event);
- });
- }
+ _proto.dispose = function dispose() {
+ $$$1(this._element).off(EVENT_KEY);
+ $$$1.removeData(this._element, DATA_KEY);
+ this._items = null;
+ this._config = null;
+ this._element = null;
+ this._interval = null;
+ this._isPaused = null;
+ this._isSliding = null;
+ this._activeElement = null;
+ this._indicatorsElement = null;
+ }; // Private
- if (this._config.pause === 'hover') {
- $(this._element).on(Event.MOUSEENTER, function (event) {
- return _this2.pause(event);
- }).on(Event.MOUSELEAVE, function (event) {
- return _this2.cycle(event);
- });
- if ('ontouchstart' in document.documentElement) {
- // If it's a touch-enabled device, mouseenter/leave are fired as
- // part of the mouse compatibility events on first tap - the carousel
- // would stop cycling until user tapped out of it;
- // here, we listen for touchend, explicitly pause the carousel
- // (as if it's the second time we tap on it, mouseenter compat event
- // is NOT fired) and after a timeout (to allow for mouse compatibility
- // events to fire) we explicitly restart cycling
- $(this._element).on(Event.TOUCHEND, function () {
- _this2.pause();
-
- if (_this2.touchTimeout) {
- clearTimeout(_this2.touchTimeout);
- }
+ _proto._getConfig = function _getConfig(config) {
+ config = _objectSpread({}, Default, config);
+ Util.typeCheckConfig(NAME, config, DefaultType);
+ return config;
+ };
+
+ _proto._addEventListeners = function _addEventListeners() {
+ var _this2 = this;
- _this2.touchTimeout = setTimeout(function (event) {
- return _this2.cycle(event);
- }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
+ if (this._config.keyboard) {
+ $$$1(this._element).on(Event.KEYDOWN, function (event) {
+ return _this2._keydown(event);
});
}
- }
- };
- _proto._keydown = function _keydown(event) {
- if (/input|textarea/i.test(event.target.tagName)) {
- return;
- }
+ if (this._config.pause === 'hover') {
+ $$$1(this._element).on(Event.MOUSEENTER, function (event) {
+ return _this2.pause(event);
+ }).on(Event.MOUSELEAVE, function (event) {
+ return _this2.cycle(event);
+ });
- switch (event.which) {
- case ARROW_LEFT_KEYCODE:
- event.preventDefault();
- this.prev();
- break;
+ if ('ontouchstart' in document.documentElement) {
+ // If it's a touch-enabled device, mouseenter/leave are fired as
+ // part of the mouse compatibility events on first tap - the carousel
+ // would stop cycling until user tapped out of it;
+ // here, we listen for touchend, explicitly pause the carousel
+ // (as if it's the second time we tap on it, mouseenter compat event
+ // is NOT fired) and after a timeout (to allow for mouse compatibility
+ // events to fire) we explicitly restart cycling
+ $$$1(this._element).on(Event.TOUCHEND, function () {
+ _this2.pause();
+
+ if (_this2.touchTimeout) {
+ clearTimeout(_this2.touchTimeout);
+ }
+
+ _this2.touchTimeout = setTimeout(function (event) {
+ return _this2.cycle(event);
+ }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
+ });
+ }
+ }
+ };
- case ARROW_RIGHT_KEYCODE:
- event.preventDefault();
- this.next();
- break;
+ _proto._keydown = function _keydown(event) {
+ if (/input|textarea/i.test(event.target.tagName)) {
+ return;
+ }
- default:
- }
- };
+ switch (event.which) {
+ case ARROW_LEFT_KEYCODE:
+ event.preventDefault();
+ this.prev();
+ break;
- _proto._getItemIndex = function _getItemIndex(element) {
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
- return this._items.indexOf(element);
- };
+ case ARROW_RIGHT_KEYCODE:
+ event.preventDefault();
+ this.next();
+ break;
- _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
- var isNextDirection = direction === Direction.NEXT;
- var isPrevDirection = direction === Direction.PREV;
+ default:
+ }
+ };
- var activeIndex = this._getItemIndex(activeElement);
+ _proto._getItemIndex = function _getItemIndex(element) {
+ this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
+ return this._items.indexOf(element);
+ };
- var lastItemIndex = this._items.length - 1;
- var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
+ _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
+ var isNextDirection = direction === Direction.NEXT;
+ var isPrevDirection = direction === Direction.PREV;
- if (isGoingToWrap && !this._config.wrap) {
- return activeElement;
- }
+ var activeIndex = this._getItemIndex(activeElement);
- var delta = direction === Direction.PREV ? -1 : 1;
- var itemIndex = (activeIndex + delta) % this._items.length;
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
- };
+ var lastItemIndex = this._items.length - 1;
+ var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
- _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
- var targetIndex = this._getItemIndex(relatedTarget);
+ if (isGoingToWrap && !this._config.wrap) {
+ return activeElement;
+ }
- var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
+ var delta = direction === Direction.PREV ? -1 : 1;
+ var itemIndex = (activeIndex + delta) % this._items.length;
+ return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
+ };
- var slideEvent = $.Event(Event.SLIDE, {
- relatedTarget: relatedTarget,
- direction: eventDirectionName,
- from: fromIndex,
- to: targetIndex
- });
- $(this._element).trigger(slideEvent);
- return slideEvent;
- };
+ _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
+ var targetIndex = this._getItemIndex(relatedTarget);
- _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
- if (this._indicatorsElement) {
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
- $(indicators).removeClass(ClassName.ACTIVE);
+ var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
- var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
+ var slideEvent = $$$1.Event(Event.SLIDE, {
+ relatedTarget: relatedTarget,
+ direction: eventDirectionName,
+ from: fromIndex,
+ to: targetIndex
+ });
+ $$$1(this._element).trigger(slideEvent);
+ return slideEvent;
+ };
+
+ _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
+ if (this._indicatorsElement) {
+ var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
+ $$$1(indicators).removeClass(ClassName.ACTIVE);
- if (nextIndicator) {
- $(nextIndicator).addClass(ClassName.ACTIVE);
+ var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
+
+ if (nextIndicator) {
+ $$$1(nextIndicator).addClass(ClassName.ACTIVE);
+ }
}
- }
- };
+ };
- _proto._slide = function _slide(direction, element) {
- var _this3 = this;
+ _proto._slide = function _slide(direction, element) {
+ var _this3 = this;
- var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
+ var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
- var activeElementIndex = this._getItemIndex(activeElement);
+ var activeElementIndex = this._getItemIndex(activeElement);
- var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
+ var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
- var nextElementIndex = this._getItemIndex(nextElement);
+ var nextElementIndex = this._getItemIndex(nextElement);
- var isCycling = Boolean(this._interval);
- var directionalClassName;
- var orderClassName;
- var eventDirectionName;
+ var isCycling = Boolean(this._interval);
+ var directionalClassName;
+ var orderClassName;
+ var eventDirectionName;
- if (direction === Direction.NEXT) {
- directionalClassName = ClassName.LEFT;
- orderClassName = ClassName.NEXT;
- eventDirectionName = Direction.LEFT;
- } else {
- directionalClassName = ClassName.RIGHT;
- orderClassName = ClassName.PREV;
- eventDirectionName = Direction.RIGHT;
- }
+ if (direction === Direction.NEXT) {
+ directionalClassName = ClassName.LEFT;
+ orderClassName = ClassName.NEXT;
+ eventDirectionName = Direction.LEFT;
+ } else {
+ directionalClassName = ClassName.RIGHT;
+ orderClassName = ClassName.PREV;
+ eventDirectionName = Direction.RIGHT;
+ }
- if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
- this._isSliding = false;
- return;
- }
+ if (nextElement && $$$1(nextElement).hasClass(ClassName.ACTIVE)) {
+ this._isSliding = false;
+ return;
+ }
- var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
+ var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
- if (slideEvent.isDefaultPrevented()) {
- return;
- }
+ if (slideEvent.isDefaultPrevented()) {
+ return;
+ }
- if (!activeElement || !nextElement) {
- // Some weirdness is happening, so we bail
- return;
- }
+ if (!activeElement || !nextElement) {
+ // Some weirdness is happening, so we bail
+ return;
+ }
- this._isSliding = true;
+ this._isSliding = true;
- if (isCycling) {
- this.pause();
- }
+ if (isCycling) {
+ this.pause();
+ }
- this._setActiveIndicatorElement(nextElement);
+ this._setActiveIndicatorElement(nextElement);
- var slidEvent = $.Event(Event.SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
+ var slidEvent = $$$1.Event(Event.SLID, {
+ relatedTarget: nextElement,
+ direction: eventDirectionName,
+ from: activeElementIndex,
+ to: nextElementIndex
+ });
- if ($(this._element).hasClass(ClassName.SLIDE)) {
- $(nextElement).addClass(orderClassName);
- Util.reflow(nextElement);
- $(activeElement).addClass(directionalClassName);
- $(nextElement).addClass(directionalClassName);
- var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
- $(activeElement).one(Util.TRANSITION_END, function () {
- $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
- $(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
- _this3._isSliding = false;
- setTimeout(function () {
- return $(_this3._element).trigger(slidEvent);
- }, 0);
- }).emulateTransitionEnd(transitionDuration);
- } else {
- $(activeElement).removeClass(ClassName.ACTIVE);
- $(nextElement).addClass(ClassName.ACTIVE);
- this._isSliding = false;
- $(this._element).trigger(slidEvent);
- }
+ if ($$$1(this._element).hasClass(ClassName.SLIDE)) {
+ $$$1(nextElement).addClass(orderClassName);
+ Util.reflow(nextElement);
+ $$$1(activeElement).addClass(directionalClassName);
+ $$$1(nextElement).addClass(directionalClassName);
+ var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
+ $$$1(activeElement).one(Util.TRANSITION_END, function () {
+ $$$1(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
+ $$$1(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
+ _this3._isSliding = false;
+ setTimeout(function () {
+ return $$$1(_this3._element).trigger(slidEvent);
+ }, 0);
+ }).emulateTransitionEnd(transitionDuration);
+ } else {
+ $$$1(activeElement).removeClass(ClassName.ACTIVE);
+ $$$1(nextElement).addClass(ClassName.ACTIVE);
+ this._isSliding = false;
+ $$$1(this._element).trigger(slidEvent);
+ }
- if (isCycling) {
- this.cycle();
- }
- }; // Static
+ if (isCycling) {
+ this.cycle();
+ }
+ }; // Static
- Carousel._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ Carousel._jQueryInterface = function _jQueryInterface(config) {
+ return this.each(function () {
+ var data = $$$1(this).data(DATA_KEY);
- var _config = _objectSpread({}, Default, $(this).data());
+ var _config = _objectSpread({}, Default, $$$1(this).data());
- if (typeof config === 'object') {
- _config = _objectSpread({}, _config, config);
- }
+ if (typeof config === 'object') {
+ _config = _objectSpread({}, _config, config);
+ }
- var action = typeof config === 'string' ? config : _config.slide;
+ var action = typeof config === 'string' ? config : _config.slide;
- if (!data) {
- data = new Carousel(this, _config);
- $(this).data(DATA_KEY, data);
- }
+ if (!data) {
+ data = new Carousel(this, _config);
+ $$$1(this).data(DATA_KEY, data);
+ }
+
+ if (typeof config === 'number') {
+ data.to(config);
+ } else if (typeof action === 'string') {
+ if (typeof data[action] === 'undefined') {
+ throw new TypeError("No method named \"" + action + "\"");
+ }
- if (typeof config === 'number') {
- data.to(config);
- } else if (typeof action === 'string') {
- if (typeof data[action] === 'undefined') {
- throw new TypeError("No method named \"" + action + "\"");
+ data[action]();
+ } else if (_config.interval) {
+ data.pause();
+ data.cycle();
}
+ });
+ };
+
+ Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
+ var selector = Util.getSelectorFromElement(this);
- data[action]();
- } else if (_config.interval) {
- data.pause();
- data.cycle();
+ if (!selector) {
+ return;
}
- });
- };
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
- var selector = Util.getSelectorFromElement(this);
+ var target = $$$1(selector)[0];
- if (!selector) {
- return;
- }
-
- var target = $(selector)[0];
+ if (!target || !$$$1(target).hasClass(ClassName.CAROUSEL)) {
+ return;
+ }
- if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
- return;
- }
+ var config = _objectSpread({}, $$$1(target).data(), $$$1(this).data());
- var config = _objectSpread({}, $(target).data(), $(this).data());
+ var slideIndex = this.getAttribute('data-slide-to');
- var slideIndex = this.getAttribute('data-slide-to');
+ if (slideIndex) {
+ config.interval = false;
+ }
- if (slideIndex) {
- config.interval = false;
- }
+ Carousel._jQueryInterface.call($$$1(target), config);
- Carousel._jQueryInterface.call($(target), config);
+ if (slideIndex) {
+ $$$1(target).data(DATA_KEY).to(slideIndex);
+ }
- if (slideIndex) {
- $(target).data(DATA_KEY).to(slideIndex);
- }
+ event.preventDefault();
+ };
- event.preventDefault();
- };
+ _createClass(Carousel, null, [{
+ key: "VERSION",
+ get: function get() {
+ return VERSION;
+ }
+ }, {
+ key: "Default",
+ get: function get() {
+ return Default;
+ }
+ }]);
- _createClass(Carousel, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION;
- }
- }, {
- key: "Default",
- get: function get() {
- return Default;
- }
- }]);
+ return Carousel;
+ }();
+ /**
+ * ------------------------------------------------------------------------
+ * Data Api implementation
+ * ------------------------------------------------------------------------
+ */
- return Carousel;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
+ $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
+ $$$1(window).on(Event.LOAD_DATA_API, function () {
+ var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
- $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
- $(window).on(Event.LOAD_DATA_API, function () {
- var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
+ for (var i = 0, len = carousels.length; i < len; i++) {
+ var $carousel = $$$1(carousels[i]);
- for (var i = 0, len = carousels.length; i < len; i++) {
- var $carousel = $(carousels[i]);
+ Carousel._jQueryInterface.call($carousel, $carousel.data());
+ }
+ });
+ /**
+ * ------------------------------------------------------------------------
+ * jQuery
+ * ------------------------------------------------------------------------
+ */
- Carousel._jQueryInterface.call($carousel, $carousel.data());
- }
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
+ $$$1.fn[NAME] = Carousel._jQueryInterface;
+ $$$1.fn[NAME].Constructor = Carousel;
- $.fn[NAME] = Carousel._jQueryInterface;
- $.fn[NAME].Constructor = Carousel;
+ $$$1.fn[NAME].noConflict = function () {
+ $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
+ return Carousel._jQueryInterface;
+ };
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return Carousel._jQueryInterface;
- };
+ return Carousel;
+ }($);
return Carousel;
-}($);
-//# sourceMappingURL=carousel.js.map \ No newline at end of file
+
+})));
+//# sourceMappingURL=carousel.js.map