diff options
author | Max Kostikov <max@kostikov.co> | 2020-07-19 14:58:19 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2020-07-19 14:58:19 +0200 |
commit | 5ea7196e78d08550b3ec93d3b708f915b3b0057f (patch) | |
tree | 07e5f865b6c83898d7ac508302a227509e8207fd /vendor/twbs/bootstrap/js/dist/carousel.js | |
parent | d0c7c99d5e1eb27281431231640c7e8c019b90e1 (diff) | |
parent | fcc47e69e424635fa54b2684329623d4f7694436 (diff) | |
download | volse-hubzilla-5ea7196e78d08550b3ec93d3b708f915b3b0057f.tar.gz volse-hubzilla-5ea7196e78d08550b3ec93d3b708f915b3b0057f.tar.bz2 volse-hubzilla-5ea7196e78d08550b3ec93d3b708f915b3b0057f.zip |
Merge branch 'dev' into 'dev'
Dev sync
See merge request kostikov/core!1
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/carousel.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/carousel.js | 187 |
1 files changed, 88 insertions, 99 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/carousel.js b/vendor/twbs/bootstrap/js/dist/carousel.js index 66e8147c0..f0dbbae99 100644 --- a/vendor/twbs/bootstrap/js/dist/carousel.js +++ b/vendor/twbs/bootstrap/js/dist/carousel.js @@ -1,6 +1,6 @@ /*! - * Bootstrap carousel.js v4.4.1 (https://getbootstrap.com/) - * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Bootstrap carousel.js v4.5.0 (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/master/LICENSE) */ (function (global, factory) { @@ -9,8 +9,8 @@ (global = global || self, global.Carousel = factory(global.jQuery, global.Util)); }(this, (function ($, Util) { 'use strict'; - $ = $ && $.hasOwnProperty('default') ? $['default'] : $; - Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util; + $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; + Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { @@ -84,7 +84,7 @@ */ var NAME = 'carousel'; - var VERSION = '4.4.1'; + var VERSION = '4.5.0'; var DATA_KEY = 'bs.carousel'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -112,48 +112,39 @@ wrap: 'boolean', touch: '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, - TOUCHSTART: "touchstart" + EVENT_KEY, - TOUCHMOVE: "touchmove" + EVENT_KEY, - TOUCHEND: "touchend" + EVENT_KEY, - POINTERDOWN: "pointerdown" + EVENT_KEY, - POINTERUP: "pointerup" + EVENT_KEY, - DRAG_START: "dragstart" + 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', - POINTER_EVENT: 'pointer-event' - }; - var Selector = { - ACTIVE: '.active', - ACTIVE_ITEM: '.active.carousel-item', - ITEM: '.carousel-item', - ITEM_IMG: '.carousel-item img', - NEXT_PREV: '.carousel-item-next, .carousel-item-prev', - INDICATORS: '.carousel-indicators', - DATA_SLIDE: '[data-slide], [data-slide-to]', - DATA_RIDE: '[data-ride="carousel"]' - }; + var DIRECTION_NEXT = 'next'; + var DIRECTION_PREV = 'prev'; + var DIRECTION_LEFT = 'left'; + var DIRECTION_RIGHT = 'right'; + var EVENT_SLIDE = "slide" + EVENT_KEY; + var EVENT_SLID = "slid" + EVENT_KEY; + var EVENT_KEYDOWN = "keydown" + EVENT_KEY; + var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY; + var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY; + var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY; + var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY; + var EVENT_TOUCHEND = "touchend" + EVENT_KEY; + var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY; + var EVENT_POINTERUP = "pointerup" + EVENT_KEY; + var EVENT_DRAG_START = "dragstart" + EVENT_KEY; + var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY; + var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY; + var CLASS_NAME_CAROUSEL = 'carousel'; + var CLASS_NAME_ACTIVE = 'active'; + var CLASS_NAME_SLIDE = 'slide'; + var CLASS_NAME_RIGHT = 'carousel-item-right'; + var CLASS_NAME_LEFT = 'carousel-item-left'; + var CLASS_NAME_NEXT = 'carousel-item-next'; + var CLASS_NAME_PREV = 'carousel-item-prev'; + var CLASS_NAME_POINTER_EVENT = 'pointer-event'; + var SELECTOR_ACTIVE = '.active'; + var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; + var SELECTOR_ITEM = '.carousel-item'; + var SELECTOR_ITEM_IMG = '.carousel-item img'; + var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; + var SELECTOR_INDICATORS = '.carousel-indicators'; + var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; + var SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; var PointerType = { TOUCH: 'touch', PEN: 'pen' @@ -164,9 +155,7 @@ * ------------------------------------------------------------------------ */ - var Carousel = - /*#__PURE__*/ - function () { + var Carousel = /*#__PURE__*/function () { function Carousel(element, config) { this._items = null; this._interval = null; @@ -178,7 +167,7 @@ this.touchDeltaX = 0; this._config = this._getConfig(config); this._element = element; - this._indicatorsElement = this._element.querySelector(Selector.INDICATORS); + this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); @@ -191,7 +180,7 @@ // Public _proto.next = function next() { if (!this._isSliding) { - this._slide(Direction.NEXT); + this._slide(DIRECTION_NEXT); } }; @@ -205,7 +194,7 @@ _proto.prev = function prev() { if (!this._isSliding) { - this._slide(Direction.PREV); + this._slide(DIRECTION_PREV); } }; @@ -214,7 +203,7 @@ this._isPaused = true; } - if (this._element.querySelector(Selector.NEXT_PREV)) { + if (this._element.querySelector(SELECTOR_NEXT_PREV)) { Util.triggerTransitionEnd(this._element); this.cycle(true); } @@ -241,7 +230,7 @@ _proto.to = function to(index) { var _this = this; - this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM); + this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); var activeIndex = this._getItemIndex(this._activeElement); @@ -250,7 +239,7 @@ } if (this._isSliding) { - $(this._element).one(Event.SLID, function () { + $(this._element).one(EVENT_SLID, function () { return _this.to(index); }); return; @@ -262,7 +251,7 @@ return; } - var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; + var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; this._slide(direction, this._items[index]); }; @@ -282,7 +271,7 @@ ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default, {}, config); + config = _objectSpread2(_objectSpread2({}, Default), config); Util.typeCheckConfig(NAME, config, DefaultType); return config; }; @@ -311,15 +300,15 @@ var _this2 = this; if (this._config.keyboard) { - $(this._element).on(Event.KEYDOWN, function (event) { + $(this._element).on(EVENT_KEYDOWN, function (event) { return _this2._keydown(event); }); } if (this._config.pause === 'hover') { - $(this._element).on(Event.MOUSEENTER, function (event) { + $(this._element).on(EVENT_MOUSEENTER, function (event) { return _this2.pause(event); - }).on(Event.MOUSELEAVE, function (event) { + }).on(EVENT_MOUSELEAVE, function (event) { return _this2.cycle(event); }); } @@ -380,27 +369,27 @@ } }; - $(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) { + $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { return e.preventDefault(); }); if (this._pointerEvent) { - $(this._element).on(Event.POINTERDOWN, function (event) { + $(this._element).on(EVENT_POINTERDOWN, function (event) { return start(event); }); - $(this._element).on(Event.POINTERUP, function (event) { + $(this._element).on(EVENT_POINTERUP, function (event) { return end(event); }); - this._element.classList.add(ClassName.POINTER_EVENT); + this._element.classList.add(CLASS_NAME_POINTER_EVENT); } else { - $(this._element).on(Event.TOUCHSTART, function (event) { + $(this._element).on(EVENT_TOUCHSTART, function (event) { return start(event); }); - $(this._element).on(Event.TOUCHMOVE, function (event) { + $(this._element).on(EVENT_TOUCHMOVE, function (event) { return move(event); }); - $(this._element).on(Event.TOUCHEND, function (event) { + $(this._element).on(EVENT_TOUCHEND, function (event) { return end(event); }); } @@ -425,13 +414,13 @@ }; _proto._getItemIndex = function _getItemIndex(element) { - this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : []; + this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : []; return this._items.indexOf(element); }; _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { - var isNextDirection = direction === Direction.NEXT; - var isPrevDirection = direction === Direction.PREV; + var isNextDirection = direction === DIRECTION_NEXT; + var isPrevDirection = direction === DIRECTION_PREV; var activeIndex = this._getItemIndex(activeElement); @@ -442,7 +431,7 @@ return activeElement; } - var delta = direction === Direction.PREV ? -1 : 1; + 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]; }; @@ -450,9 +439,9 @@ _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { var targetIndex = this._getItemIndex(relatedTarget); - var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM)); + var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); - var slideEvent = $.Event(Event.SLIDE, { + var slideEvent = $.Event(EVENT_SLIDE, { relatedTarget: relatedTarget, direction: eventDirectionName, from: fromIndex, @@ -464,13 +453,13 @@ _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { if (this._indicatorsElement) { - var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE)); - $(indicators).removeClass(ClassName.ACTIVE); + var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE)); + $(indicators).removeClass(CLASS_NAME_ACTIVE); var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; if (nextIndicator) { - $(nextIndicator).addClass(ClassName.ACTIVE); + $(nextIndicator).addClass(CLASS_NAME_ACTIVE); } } }; @@ -478,7 +467,7 @@ _proto._slide = function _slide(direction, element) { var _this4 = this; - var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM); + var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); var activeElementIndex = this._getItemIndex(activeElement); @@ -491,17 +480,17 @@ var orderClassName; var eventDirectionName; - if (direction === Direction.NEXT) { - directionalClassName = ClassName.LEFT; - orderClassName = ClassName.NEXT; - eventDirectionName = Direction.LEFT; + if (direction === DIRECTION_NEXT) { + directionalClassName = CLASS_NAME_LEFT; + orderClassName = CLASS_NAME_NEXT; + eventDirectionName = DIRECTION_LEFT; } else { - directionalClassName = ClassName.RIGHT; - orderClassName = ClassName.PREV; - eventDirectionName = Direction.RIGHT; + directionalClassName = CLASS_NAME_RIGHT; + orderClassName = CLASS_NAME_PREV; + eventDirectionName = DIRECTION_RIGHT; } - if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { + if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE)) { this._isSliding = false; return; } @@ -525,14 +514,14 @@ this._setActiveIndicatorElement(nextElement); - var slidEvent = $.Event(Event.SLID, { + var slidEvent = $.Event(EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, to: nextElementIndex }); - if ($(this._element).hasClass(ClassName.SLIDE)) { + if ($(this._element).hasClass(CLASS_NAME_SLIDE)) { $(nextElement).addClass(orderClassName); Util.reflow(nextElement); $(activeElement).addClass(directionalClassName); @@ -548,16 +537,16 @@ var transitionDuration = Util.getTransitionDurationFromElement(activeElement); $(activeElement).one(Util.TRANSITION_END, function () { - $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE); - $(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName); + $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE); + $(activeElement).removeClass(CLASS_NAME_ACTIVE + " " + orderClassName + " " + directionalClassName); _this4._isSliding = false; setTimeout(function () { return $(_this4._element).trigger(slidEvent); }, 0); }).emulateTransitionEnd(transitionDuration); } else { - $(activeElement).removeClass(ClassName.ACTIVE); - $(nextElement).addClass(ClassName.ACTIVE); + $(activeElement).removeClass(CLASS_NAME_ACTIVE); + $(nextElement).addClass(CLASS_NAME_ACTIVE); this._isSliding = false; $(this._element).trigger(slidEvent); } @@ -572,10 +561,10 @@ return this.each(function () { var data = $(this).data(DATA_KEY); - var _config = _objectSpread2({}, Default, {}, $(this).data()); + var _config = _objectSpread2(_objectSpread2({}, Default), $(this).data()); if (typeof config === 'object') { - _config = _objectSpread2({}, _config, {}, config); + _config = _objectSpread2(_objectSpread2({}, _config), config); } var action = typeof config === 'string' ? config : _config.slide; @@ -609,11 +598,11 @@ var target = $(selector)[0]; - if (!target || !$(target).hasClass(ClassName.CAROUSEL)) { + if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) { return; } - var config = _objectSpread2({}, $(target).data(), {}, $(this).data()); + var config = _objectSpread2(_objectSpread2({}, $(target).data()), $(this).data()); var slideIndex = this.getAttribute('data-slide-to'); @@ -651,9 +640,9 @@ */ - $(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)); + $(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 = $(carousels[i]); |