diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/alert.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/alert.js | 269 |
1 files changed, 132 insertions, 137 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/alert.js b/vendor/twbs/bootstrap/js/dist/alert.js index a7d1721ae..2a2e157ed 100644 --- a/vendor/twbs/bootstrap/js/dist/alert.js +++ b/vendor/twbs/bootstrap/js/dist/alert.js @@ -1,8 +1,13 @@ +/*! + * Bootstrap alert.js v4.3.1 (https://getbootstrap.com/) + * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ (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.Alert = factory(global.jQuery,global.Util)); -}(this, (function ($,Util) { 'use strict'; + (global = global || self, global.Alert = factory(global.jQuery, global.Util)); +}(this, function ($, Util) { 'use strict'; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util; @@ -24,181 +29,171 @@ } /** - * -------------------------------------------------------------------------- - * Bootstrap (v4.1.3): alert.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ */ - var Alert = function ($$$1) { + var NAME = 'alert'; + var VERSION = '4.3.1'; + var DATA_KEY = 'bs.alert'; + var EVENT_KEY = "." + DATA_KEY; + var DATA_API_KEY = '.data-api'; + var JQUERY_NO_CONFLICT = $.fn[NAME]; + var Selector = { + DISMISS: '[data-dismiss="alert"]' + }; + var Event = { + CLOSE: "close" + EVENT_KEY, + CLOSED: "closed" + EVENT_KEY, + CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY + }; + var ClassName = { + ALERT: 'alert', + FADE: 'fade', + SHOW: 'show' /** * ------------------------------------------------------------------------ - * Constants + * Class Definition * ------------------------------------------------------------------------ */ - var NAME = 'alert'; - var VERSION = '4.1.3'; - var DATA_KEY = 'bs.alert'; - var EVENT_KEY = "." + DATA_KEY; - var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; - var Selector = { - DISMISS: '[data-dismiss="alert"]' - }; - var Event = { - CLOSE: "close" + EVENT_KEY, - CLOSED: "closed" + EVENT_KEY, - CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY - }; - var ClassName = { - ALERT: 'alert', - FADE: 'fade', - SHOW: 'show' - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - }; + }; - var Alert = - /*#__PURE__*/ - function () { - function Alert(element) { - this._element = element; - } // Getters + var Alert = + /*#__PURE__*/ + function () { + function Alert(element) { + this._element = element; + } // Getters - var _proto = Alert.prototype; + var _proto = Alert.prototype; - // Public - _proto.close = function close(element) { - var rootElement = this._element; + // Public + _proto.close = function close(element) { + var rootElement = this._element; - if (element) { - rootElement = this._getRootElement(element); - } + if (element) { + rootElement = this._getRootElement(element); + } - var customEvent = this._triggerCloseEvent(rootElement); + var customEvent = this._triggerCloseEvent(rootElement); - if (customEvent.isDefaultPrevented()) { - return; - } + if (customEvent.isDefaultPrevented()) { + return; + } - this._removeElement(rootElement); - }; + this._removeElement(rootElement); + }; - _proto.dispose = function dispose() { - $$$1.removeData(this._element, DATA_KEY); - this._element = null; - }; // Private + _proto.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + this._element = null; + } // Private + ; + _proto._getRootElement = function _getRootElement(element) { + var selector = Util.getSelectorFromElement(element); + var parent = false; - _proto._getRootElement = function _getRootElement(element) { - var selector = Util.getSelectorFromElement(element); - var parent = false; + if (selector) { + parent = document.querySelector(selector); + } - if (selector) { - parent = document.querySelector(selector); - } + if (!parent) { + parent = $(element).closest("." + ClassName.ALERT)[0]; + } - if (!parent) { - parent = $$$1(element).closest("." + ClassName.ALERT)[0]; - } - - return parent; - }; - - _proto._triggerCloseEvent = function _triggerCloseEvent(element) { - var closeEvent = $$$1.Event(Event.CLOSE); - $$$1(element).trigger(closeEvent); - return closeEvent; - }; + return parent; + }; - _proto._removeElement = function _removeElement(element) { - var _this = this; + _proto._triggerCloseEvent = function _triggerCloseEvent(element) { + var closeEvent = $.Event(Event.CLOSE); + $(element).trigger(closeEvent); + return closeEvent; + }; - $$$1(element).removeClass(ClassName.SHOW); + _proto._removeElement = function _removeElement(element) { + var _this = this; - if (!$$$1(element).hasClass(ClassName.FADE)) { - this._destroyElement(element); + $(element).removeClass(ClassName.SHOW); - return; - } + if (!$(element).hasClass(ClassName.FADE)) { + this._destroyElement(element); - var transitionDuration = Util.getTransitionDurationFromElement(element); - $$$1(element).one(Util.TRANSITION_END, function (event) { - return _this._destroyElement(element, event); - }).emulateTransitionEnd(transitionDuration); - }; + return; + } - _proto._destroyElement = function _destroyElement(element) { - $$$1(element).detach().trigger(Event.CLOSED).remove(); - }; // Static + var transitionDuration = Util.getTransitionDurationFromElement(element); + $(element).one(Util.TRANSITION_END, function (event) { + return _this._destroyElement(element, event); + }).emulateTransitionEnd(transitionDuration); + }; + _proto._destroyElement = function _destroyElement(element) { + $(element).detach().trigger(Event.CLOSED).remove(); + } // Static + ; - Alert._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var $element = $$$1(this); - var data = $element.data(DATA_KEY); + Alert._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var $element = $(this); + var data = $element.data(DATA_KEY); - if (!data) { - data = new Alert(this); - $element.data(DATA_KEY, data); - } + if (!data) { + data = new Alert(this); + $element.data(DATA_KEY, data); + } - if (config === 'close') { - data[config](this); - } - }); - }; + if (config === 'close') { + data[config](this); + } + }); + }; - Alert._handleDismiss = function _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault(); - } + Alert._handleDismiss = function _handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); + } - alertInstance.close(this); - }; + alertInstance.close(this); }; + }; - _createClass(Alert, null, [{ - key: "VERSION", - get: function get() { - return VERSION; - } - }]); - - return Alert; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ + _createClass(Alert, null, [{ + key: "VERSION", + get: function get() { + return VERSION; + } + }]); + return Alert; + }(); + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ - $$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - $$$1.fn[NAME] = Alert._jQueryInterface; - $$$1.fn[NAME].Constructor = Alert; + $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ - $$$1.fn[NAME].noConflict = function () { - $$$1.fn[NAME] = JQUERY_NO_CONFLICT; - return Alert._jQueryInterface; - }; + $.fn[NAME] = Alert._jQueryInterface; + $.fn[NAME].Constructor = Alert; - return Alert; - }($); + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Alert._jQueryInterface; + }; return Alert; -}))); +})); //# sourceMappingURL=alert.js.map |