mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-11 08:04:59 +02:00
Prepare v5.0.0-alpha3 (#32122)
This commit is contained in:
70
js/dist/carousel.js
vendored
70
js/dist/carousel.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap carousel.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
||||
* Bootstrap carousel.js v5.0.0-alpha3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
||||
* Bootstrap (v5.0.0-alpha3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -139,6 +139,14 @@
|
||||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
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); } }
|
||||
@@ -151,7 +159,7 @@
|
||||
*/
|
||||
|
||||
var NAME = 'carousel';
|
||||
var VERSION = '5.0.0-alpha2';
|
||||
var VERSION = '5.0.0-alpha3';
|
||||
var DATA_KEY = 'bs.carousel';
|
||||
var EVENT_KEY = "." + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
@@ -289,6 +297,8 @@
|
||||
}
|
||||
|
||||
if (this._config && this._config.interval && !this._isPaused) {
|
||||
this._updateInterval();
|
||||
|
||||
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
||||
}
|
||||
};
|
||||
@@ -530,6 +540,23 @@
|
||||
}
|
||||
};
|
||||
|
||||
_proto._updateInterval = function _updateInterval() {
|
||||
var element = this._activeElement || SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
var elementInterval = parseInt(element.getAttribute('data-interval'), 10);
|
||||
|
||||
if (elementInterval) {
|
||||
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
||||
this._config.interval = elementInterval;
|
||||
} else {
|
||||
this._config.interval = this._config.defaultInterval || this._config.interval;
|
||||
}
|
||||
};
|
||||
|
||||
_proto._slide = function _slide(direction, element) {
|
||||
var _this4 = this;
|
||||
|
||||
@@ -580,20 +607,13 @@
|
||||
|
||||
this._setActiveIndicatorElement(nextElement);
|
||||
|
||||
this._activeElement = nextElement;
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
||||
nextElement.classList.add(orderClassName);
|
||||
reflow(nextElement);
|
||||
activeElement.classList.add(directionalClassName);
|
||||
nextElement.classList.add(directionalClassName);
|
||||
var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
||||
|
||||
if (nextElementInterval) {
|
||||
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
||||
this._config.interval = nextElementInterval;
|
||||
} else {
|
||||
this._config.interval = this._config.defaultInterval || this._config.interval;
|
||||
}
|
||||
|
||||
var transitionDuration = getTransitionDurationFromElement(activeElement);
|
||||
EventHandler__default['default'].one(activeElement, TRANSITION_END, function () {
|
||||
nextElement.classList.remove(directionalClassName, orderClassName);
|
||||
@@ -720,26 +740,28 @@
|
||||
Carousel.carouselInterface(carousels[i], Data__default['default'].getData(carousels[i], DATA_KEY));
|
||||
}
|
||||
});
|
||||
var $ = getjQuery();
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
* ------------------------------------------------------------------------
|
||||
* add .carousel to jQuery only if jQuery is present
|
||||
* add .Carousel to jQuery only if jQuery is present
|
||||
*/
|
||||
|
||||
/* istanbul ignore if */
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||
$.fn[NAME] = Carousel.jQueryInterface;
|
||||
$.fn[NAME].Constructor = Carousel;
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||
$.fn[NAME] = Carousel.jQueryInterface;
|
||||
$.fn[NAME].Constructor = Carousel;
|
||||
|
||||
$.fn[NAME].noConflict = function () {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||
return Carousel.jQueryInterface;
|
||||
};
|
||||
}
|
||||
$.fn[NAME].noConflict = function () {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||
return Carousel.jQueryInterface;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return Carousel;
|
||||
|
||||
|
Reference in New Issue
Block a user