1"use strict"; 2 3function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 4 5(function (global, factory) { 6 (typeof exports === "undefined" ? "undefined" : _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 = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.jQuery, global.Util)); 7})(void 0, function ($, Util) { 8 'use strict'; 9 10 function _interopDefaultLegacy(e) { 11 return e && _typeof(e) === 'object' && 'default' in e ? e : { 12 'default': e 13 }; 14 } 15 16 var $__default = _interopDefaultLegacy($); 17 18 var Util__default = _interopDefaultLegacy(Util); 19 20 function _defineProperties(target, props) { 21 for (var i = 0; i < props.length; i++) { 22 var descriptor = props[i]; 23 descriptor.enumerable = descriptor.enumerable || false; 24 descriptor.configurable = true; 25 if ("value" in descriptor) descriptor.writable = true; 26 Object.defineProperty(target, descriptor.key, descriptor); 27 } 28 } 29 30 function _createClass(Constructor, protoProps, staticProps) { 31 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 32 if (staticProps) _defineProperties(Constructor, staticProps); 33 return Constructor; 34 } 35 36 var NAME = 'alert'; 37 var VERSION = '4.5.3'; 38 var DATA_KEY = 'bs.alert'; 39 var EVENT_KEY = "." + DATA_KEY; 40 var DATA_API_KEY = '.data-api'; 41 var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME]; 42 var SELECTOR_DISMISS = '[data-dismiss="alert"]'; 43 var EVENT_CLOSE = "close" + EVENT_KEY; 44 var EVENT_CLOSED = "closed" + EVENT_KEY; 45 var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY; 46 var CLASS_NAME_ALERT = 'alert'; 47 var CLASS_NAME_FADE = 'fade'; 48 var CLASS_NAME_SHOW = 'show'; 49 50 var Alert = function () { 51 function Alert(element) { 52 this._element = element; 53 } 54 55 var _proto = Alert.prototype; 56 57 _proto.close = function close(element) { 58 var rootElement = this._element; 59 60 if (element) { 61 rootElement = this._getRootElement(element); 62 } 63 64 var customEvent = this._triggerCloseEvent(rootElement); 65 66 if (customEvent.isDefaultPrevented()) { 67 return; 68 } 69 70 this._removeElement(rootElement); 71 }; 72 73 _proto.dispose = function dispose() { 74 $__default['default'].removeData(this._element, DATA_KEY); 75 this._element = null; 76 }; 77 78 _proto._getRootElement = function _getRootElement(element) { 79 var selector = Util__default['default'].getSelectorFromElement(element); 80 var parent = false; 81 82 if (selector) { 83 parent = document.querySelector(selector); 84 } 85 86 if (!parent) { 87 parent = $__default['default'](element).closest("." + CLASS_NAME_ALERT)[0]; 88 } 89 90 return parent; 91 }; 92 93 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 94 var closeEvent = $__default['default'].Event(EVENT_CLOSE); 95 $__default['default'](element).trigger(closeEvent); 96 return closeEvent; 97 }; 98 99 _proto._removeElement = function _removeElement(element) { 100 var _this = this; 101 102 $__default['default'](element).removeClass(CLASS_NAME_SHOW); 103 104 if (!$__default['default'](element).hasClass(CLASS_NAME_FADE)) { 105 this._destroyElement(element); 106 107 return; 108 } 109 110 var transitionDuration = Util__default['default'].getTransitionDurationFromElement(element); 111 $__default['default'](element).one(Util__default['default'].TRANSITION_END, function (event) { 112 return _this._destroyElement(element, event); 113 }).emulateTransitionEnd(transitionDuration); 114 }; 115 116 _proto._destroyElement = function _destroyElement(element) { 117 $__default['default'](element).detach().trigger(EVENT_CLOSED).remove(); 118 }; 119 120 Alert._jQueryInterface = function _jQueryInterface(config) { 121 return this.each(function () { 122 var $element = $__default['default'](this); 123 var data = $element.data(DATA_KEY); 124 125 if (!data) { 126 data = new Alert(this); 127 $element.data(DATA_KEY, data); 128 } 129 130 if (config === 'close') { 131 data[config](this); 132 } 133 }); 134 }; 135 136 Alert._handleDismiss = function _handleDismiss(alertInstance) { 137 return function (event) { 138 if (event) { 139 event.preventDefault(); 140 } 141 142 alertInstance.close(this); 143 }; 144 }; 145 146 _createClass(Alert, null, [{ 147 key: "VERSION", 148 get: function get() { 149 return VERSION; 150 } 151 }]); 152 153 return Alert; 154 }(); 155 156 $__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert())); 157 $__default['default'].fn[NAME] = Alert._jQueryInterface; 158 $__default['default'].fn[NAME].Constructor = Alert; 159 160 $__default['default'].fn[NAME].noConflict = function () { 161 $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT; 162 return Alert._jQueryInterface; 163 }; 164 165 return Alert; 166});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.