1import { e as enableDismissTrigger, d as defineJQueryPlugin, B as BaseComponent, E as EventHandler } from './dom.js?5.3.8'; 2 3/** 4 * -------------------------------------------------------------------------- 5 * Bootstrap alert.js 6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 7 * -------------------------------------------------------------------------- 8 */ 9 10 11/** 12 * Constants 13 */ 14 15const NAME = 'alert'; 16const DATA_KEY = 'bs.alert'; 17const EVENT_KEY = `.${DATA_KEY}`; 18const EVENT_CLOSE = `close${EVENT_KEY}`; 19const EVENT_CLOSED = `closed${EVENT_KEY}`; 20const CLASS_NAME_FADE = 'fade'; 21const CLASS_NAME_SHOW = 'show'; 22 23/** 24 * Class definition 25 */ 26 27class Alert extends BaseComponent { 28 // Getters 29 static get NAME() { 30 return NAME; 31 } 32 33 // Public 34 close() { 35 const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); 36 if (closeEvent.defaultPrevented) { 37 return; 38 } 39 this._element.classList.remove(CLASS_NAME_SHOW); 40 const isAnimated = this._element.classList.contains(CLASS_NAME_FADE); 41 this._queueCallback(() => this._destroyElement(), this._element, isAnimated); 42 } 43 44 // Private 45 _destroyElement() { 46 this._element.remove(); 47 EventHandler.trigger(this._element, EVENT_CLOSED); 48 this.dispose(); 49 } 50 51 // Static 52 static jQueryInterface(config) { 53 return this.each(function () { 54 const data = Alert.getOrCreateInstance(this); 55 if (typeof config !== 'string') { 56 return; 57 } 58 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 59 throw new TypeError(`No method named "${config}"`); 60 } 61 data[config](this); 62 }); 63 } 64} 65 66/** 67 * Data API implementation 68 */ 69 70enableDismissTrigger(Alert, 'close'); 71 72/** 73 * jQuery 74 */ 75 76defineJQueryPlugin(Alert); 77 78window.bootstrap = window.bootstrap || {}; 79window.bootstrap.Alert = Alert; 80if (Joomla && Joomla.getOptions) { 81 // Get the elements/configurations from the PHP 82 const alerts = Joomla.getOptions('bootstrap.alert'); 83 // Initialise the elements 84 if (alerts && alerts.length) { 85 alerts.forEach(selector => { 86 document.querySelectorAll(selector).forEach(el => new window.bootstrap.Alert(el)); 87 }); 88 } 89} 90 91export { Alert as A };
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.