Server IP : 15.235.198.142 / Your IP : 216.73.216.150 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/bootstrap-html/js/ |
Upload File : |
/*! * Bootstrap carousel.js v5.3.1 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./util/index.js'), require('./util/swipe.js')) : typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './util/index', './util/swipe'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.BaseComponent, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Index, global.Swipe)); })(this, (function (BaseComponent, EventHandler, Manipulator, SelectorEngine, index_js, Swipe) { 'use strict'; 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, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } var _KEY_TO_DIRECTION; /** * Constants */ var NAME = 'carousel'; var DATA_KEY = 'bs.carousel'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; var ARROW_LEFT_KEY = 'ArrowLeft'; var ARROW_RIGHT_KEY = 'ArrowRight'; var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch var ORDER_NEXT = 'next'; var ORDER_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_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_END = 'carousel-item-end'; var CLASS_NAME_START = 'carousel-item-start'; var CLASS_NAME_NEXT = 'carousel-item-next'; var CLASS_NAME_PREV = 'carousel-item-prev'; var SELECTOR_ACTIVE = '.active'; var SELECTOR_ITEM = '.carousel-item'; var SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; var SELECTOR_ITEM_IMG = '.carousel-item img'; var SELECTOR_INDICATORS = '.carousel-indicators'; var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; var KEY_TO_DIRECTION = (_KEY_TO_DIRECTION = {}, _KEY_TO_DIRECTION[ARROW_LEFT_KEY] = DIRECTION_RIGHT, _KEY_TO_DIRECTION[ARROW_RIGHT_KEY] = DIRECTION_LEFT, _KEY_TO_DIRECTION); var Default = { interval: 5000, keyboard: true, pause: 'hover', ride: false, touch: true, wrap: true }; var DefaultType = { interval: '(number|boolean)', // TODO:v6 remove boolean support keyboard: 'boolean', pause: '(string|boolean)', ride: '(boolean|string)', touch: 'boolean', wrap: 'boolean' }; /** * Class definition */ var Carousel = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Carousel, _BaseComponent); function Carousel(element, config) { var _this; _this = _BaseComponent.call(this, element, config) || this; _this._interval = null; _this._activeElement = null; _this._isSliding = false; _this.touchTimeout = null; _this._swipeHelper = null; _this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, _this._element); _this._addEventListeners(); if (_this._config.ride === CLASS_NAME_CAROUSEL) { _this.cycle(); } return _this; } // Getters var _proto = Carousel.prototype; // Public _proto.next = function next() { this._slide(ORDER_NEXT); }; _proto.nextWhenVisible = function nextWhenVisible() { // FIXME TODO use `document.visibilityState` // Don't call next when the page isn't visible // or the carousel or its parent isn't visible if (!document.hidden && index_js.isVisible(this._element)) { this.next(); } }; _proto.prev = function prev() { this._slide(ORDER_PREV); }; _proto.pause = function pause() { if (this._isSliding) { index_js.triggerTransitionEnd(this._element); } this._clearInterval(); }; _proto.cycle = function cycle() { var _this2 = this; this._clearInterval(); this._updateInterval(); this._interval = setInterval(function () { return _this2.nextWhenVisible(); }, this._config.interval); }; _proto._maybeEnableCycle = function _maybeEnableCycle() { var _this3 = this; if (!this._config.ride) { return; } if (this._isSliding) { EventHandler.one(this._element, EVENT_SLID, function () { return _this3.cycle(); }); return; } this.cycle(); }; _proto.to = function to(index) { var _this4 = this; var items = this._getItems(); if (index > items.length - 1 || index < 0) { return; } if (this._isSliding) { EventHandler.one(this._element, EVENT_SLID, function () { return _this4.to(index); }); return; } var activeIndex = this._getItemIndex(this._getActive()); if (activeIndex === index) { return; } var order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; this._slide(order, items[index]); }; _proto.dispose = function dispose() { if (this._swipeHelper) { this._swipeHelper.dispose(); } _BaseComponent.prototype.dispose.call(this); } // Private ; _proto._configAfterMerge = function _configAfterMerge(config) { config.defaultInterval = config.interval; return config; }; _proto._addEventListeners = function _addEventListeners() { var _this5 = this; if (this._config.keyboard) { EventHandler.on(this._element, EVENT_KEYDOWN, function (event) { return _this5._keydown(event); }); } if (this._config.pause === 'hover') { EventHandler.on(this._element, EVENT_MOUSEENTER, function () { return _this5.pause(); }); EventHandler.on(this._element, EVENT_MOUSELEAVE, function () { return _this5._maybeEnableCycle(); }); } if (this._config.touch && Swipe.isSupported()) { this._addTouchEventListeners(); } }; _proto._addTouchEventListeners = function _addTouchEventListeners() { var _this6 = this; for (var _iterator = _createForOfIteratorHelperLoose(SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)), _step; !(_step = _iterator()).done;) { var img = _step.value; EventHandler.on(img, EVENT_DRAG_START, function (event) { return event.preventDefault(); }); } var endCallBack = function endCallBack() { if (_this6._config.pause !== 'hover') { return; } // 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 _this6.pause(); if (_this6.touchTimeout) { clearTimeout(_this6.touchTimeout); } _this6.touchTimeout = setTimeout(function () { return _this6._maybeEnableCycle(); }, TOUCHEVENT_COMPAT_WAIT + _this6._config.interval); }; var swipeConfig = { leftCallback: function leftCallback() { return _this6._slide(_this6._directionToOrder(DIRECTION_LEFT)); }, rightCallback: function rightCallback() { return _this6._slide(_this6._directionToOrder(DIRECTION_RIGHT)); }, endCallback: endCallBack }; this._swipeHelper = new Swipe(this._element, swipeConfig); }; _proto._keydown = function _keydown(event) { if (/input|textarea/i.test(event.target.tagName)) { return; } var direction = KEY_TO_DIRECTION[event.key]; if (direction) { event.preventDefault(); this._slide(this._directionToOrder(direction)); } }; _proto._getItemIndex = function _getItemIndex(element) { return this._getItems().indexOf(element); }; _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(index) { if (!this._indicatorsElement) { return; } var activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); activeIndicator.classList.remove(CLASS_NAME_ACTIVE); activeIndicator.removeAttribute('aria-current'); var newActiveIndicator = SelectorEngine.findOne("[data-bs-slide-to=\"" + index + "\"]", this._indicatorsElement); if (newActiveIndicator) { newActiveIndicator.classList.add(CLASS_NAME_ACTIVE); newActiveIndicator.setAttribute('aria-current', 'true'); } }; _proto._updateInterval = function _updateInterval() { var element = this._activeElement || this._getActive(); if (!element) { return; } var elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); this._config.interval = elementInterval || this._config.defaultInterval; }; _proto._slide = function _slide(order, element) { var _this7 = this; if (element === void 0) { element = null; } if (this._isSliding) { return; } var activeElement = this._getActive(); var isNext = order === ORDER_NEXT; var nextElement = element || index_js.getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap); if (nextElement === activeElement) { return; } var nextElementIndex = this._getItemIndex(nextElement); var triggerEvent = function triggerEvent(eventName) { return EventHandler.trigger(_this7._element, eventName, { relatedTarget: nextElement, direction: _this7._orderToDirection(order), from: _this7._getItemIndex(activeElement), to: nextElementIndex }); }; var slideEvent = triggerEvent(EVENT_SLIDE); if (slideEvent.defaultPrevented) { return; } if (!activeElement || !nextElement) { // Some weirdness is happening, so we bail // TODO: change tests that use empty divs to avoid this check return; } var isCycling = Boolean(this._interval); this.pause(); this._isSliding = true; this._setActiveIndicatorElement(nextElementIndex); this._activeElement = nextElement; var directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; var orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; nextElement.classList.add(orderClassName); index_js.reflow(nextElement); activeElement.classList.add(directionalClassName); nextElement.classList.add(directionalClassName); var completeCallBack = function completeCallBack() { nextElement.classList.remove(directionalClassName, orderClassName); nextElement.classList.add(CLASS_NAME_ACTIVE); activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName); _this7._isSliding = false; triggerEvent(EVENT_SLID); }; this._queueCallback(completeCallBack, activeElement, this._isAnimated()); if (isCycling) { this.cycle(); } }; _proto._isAnimated = function _isAnimated() { return this._element.classList.contains(CLASS_NAME_SLIDE); }; _proto._getActive = function _getActive() { return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); }; _proto._getItems = function _getItems() { return SelectorEngine.find(SELECTOR_ITEM, this._element); }; _proto._clearInterval = function _clearInterval() { if (this._interval) { clearInterval(this._interval); this._interval = null; } }; _proto._directionToOrder = function _directionToOrder(direction) { if (index_js.isRTL()) { return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; } return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; }; _proto._orderToDirection = function _orderToDirection(order) { if (index_js.isRTL()) { return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; } return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; } // Static ; Carousel.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Carousel.getOrCreateInstance(this, config); if (typeof config === 'number') { data.to(config); return; } if (typeof config === 'string') { if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }); }; _createClass(Carousel, null, [{ key: "Default", get: function get() { return Default; } }, { key: "DefaultType", get: function get() { return DefaultType; } }, { key: "NAME", get: function get() { return NAME; } }]); return Carousel; }(BaseComponent); /** * Data API implementation */ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) { var target = SelectorEngine.getElementFromSelector(this); if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { return; } event.preventDefault(); var carousel = Carousel.getOrCreateInstance(target); var slideIndex = this.getAttribute('data-bs-slide-to'); if (slideIndex) { carousel.to(slideIndex); carousel._maybeEnableCycle(); return; } if (Manipulator.getDataAttribute(this, 'slide') === 'next') { carousel.next(); carousel._maybeEnableCycle(); return; } carousel.prev(); carousel._maybeEnableCycle(); }); EventHandler.on(window, EVENT_LOAD_DATA_API, function () { var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); for (var _iterator2 = _createForOfIteratorHelperLoose(carousels), _step2; !(_step2 = _iterator2()).done;) { var carousel = _step2.value; Carousel.getOrCreateInstance(carousel); } }); /** * jQuery */ index_js.defineJQueryPlugin(Carousel); return Carousel; })); //# sourceMappingURL=carousel.js.map