- md5
- 20d67d67105ea4c608f81975fb5e55af
- sha1
- f0e91f0752dc3c520ab413372123ede1687cbec8
- sha256
- 9495f7820eac6b9830a7cff2a2d3272c836a83e69eac150366c01c3b886e222a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
function _typeof(obj) {
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
_typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
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, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
(function () {
var JoomlaAlertElement =
/*#__PURE__*/
function (_HTMLElement) {
_inherits(JoomlaAlertElement, _HTMLElement);
function JoomlaAlertElement() {
_classCallCheck(this, JoomlaAlertElement);
return _possibleConstructorReturn(this, _getPrototypeOf(JoomlaAlertElement).apply(this, arguments));
}
_createClass(JoomlaAlertElement, [{
key: "connectedCallback",
/* Lifecycle, element appended to the DOM */
value: function connectedCallback() {
this.setAttribute('role', 'alertdialog');
this.classList.add('joomla-alert--show'); // Default to info
if (!this.type || ['info', 'warning', 'danger', 'success'].indexOf(this.type) === -1) {
this.setAttribute('type', 'info');
} // Append button
if (this.hasAttribute('dismiss') || this.hasAttribute('acknowledge') || this.hasAttribute('href') && this.getAttribute('href') !== '' && !this.querySelector('button.joomla-alert--close') && !this.querySelector('button.joomla-alert-button--close')) {
this.appendCloseButton();
}
this.dispatchCustomEvent('joomla.alert.show');
}
/* Lifecycle, element removed from the DOM */
}, {
key: "disconnectedCallback",
value: function disconnectedCallback() {
this.removeEventListener('joomla.alert.show', this);
this.removeEventListener('joomla.alert.close', this);
this.removeEventListener('joomla.alert.closed', this);
if (this.firstChild.tagName && this.firstChild.tagName.toLowerCase() === 'button') {
this.firstChild.removeEventListener('click', this);
}
}
/* Respond to attribute changes */
}, {
key: "attributeChangedCallback",
value: function attributeChangedCallback(attr, oldValue, newValue) {
switch (attr) {
case 'type':
if (!newValue || newValue && ['info', 'warning', 'danger', 'success'].indexOf(newValue) === -1) {
this.type = 'info';
}
break;
case 'dismiss':
case 'acknowledge':
if (!newValue || newValue === 'true') {
this.appendCloseButton();
} else {
this.removeCloseButton();
}
break;
case 'href':
if (!newValue || newValue === '') {
this.removeCloseButton();
} else if (!this.querySelector('button.joomla-alert-button--close')) {
this.appendCloseButton();
}
break;
default:
break;
}
}
/* Method to close the alert */
}, {
key: "close",
value: function close() {
var _this = this;
this.dispatchCustomEvent('joomla.alert.close');
this.addEventListener('transitionend', function () {
_this.dispatchCustomEvent('joomla.alert.closed');
_this.parentNode.removeChild(_this);
}, false);
this.classList.remove('joomla-alert--show');
}
/* Method to dispatch events */
}, {
key: "dispatchCustomEvent",
value: function dispatchCustomEvent(eventName) {
var OriginalCustomEvent = new CustomEvent(eventName);
OriginalCustomEvent.relatedTarget = this;
this.dispatchEvent(OriginalCustomEvent);
this.removeEventListener(eventName, this);
}
/* Method to create the close button */
}, {
key: "appendCloseButton",
value: function appendCloseButton() {
if (this.querySelector('button.joomla-alert--close') || this.querySelector('button.joomla-alert-button--close')) {
return;
}
var self = this;
var closeButton = document.createElement('button');
if (this.hasAttribute('dismiss')) {
closeButton.classList.add('joomla-alert--close');
closeButton.innerHTML = '<span aria-hidden="true">×</span>';
closeButton.setAttribute('aria-label', this.getText('JCLOSE', 'Close'));
} else {
closeButton.classList.add('joomla-alert-button--close');
if (this.hasAttribute('acknowledge')) {
closeButton.innerHTML = this.getText('JOK', 'ok');
} else {
closeButton.innerHTML = this.getText('JOPEN', 'Open');
}
}
if (this.firstChild) {
this.insertBefore(closeButton, this.firstChild);
} else {
this.appendChild(closeButton);
}
/* Add the required listener */
if (closeButton) {
if (!this.href) {
closeButton.addEventListener('click', function () {
self.dispatchCustomEvent('joomla.alert.buttonClicked');
if (self.getAttribute('data-callback')) {
window[self.getAttribute('data-callback')]();
self.close();
} else {
self.close();
}
});
} else {
closeButton.addEventListener('click', function () {
self.dispatchCustomEvent('joomla.alert.buttonClicked');
window.location.href = self.href;
self.close();
});
}
}
if (this.hasAttribute('auto-dismiss')) {
setTimeout(function () {
self.dispatchCustomEvent('joomla.alert.buttonClicked');
if (self.hasAttribute('data-callback')) {
window[self.getAttribute('data-callback')]();
} else {
self.close();
}
}, parseInt(self.getAttribute('auto-dismiss'), 10) ? self.getAttribute('auto-dismiss') : 3000);
}
}
/* Method to remove the close button */
}, {
key: "removeCloseButton",
value: function removeCloseButton() {
var button = this.querySelector('button');
if (button) {
button.removeEventListener('click', this);
button.parentNode.removeChild(button);
}
}
/* Method to get the translated text */
}, {
key: "getText",
value: function getText(str, fallback) {
// TODO: Remove coupling to Joomla CMS Core JS here
/* eslint-disable-next-line no-undef */
return window.Joomla && Joomla.JText && Joomla.JText._ && typeof Joomla.JText._ === 'function' && Joomla.JText._(str) ? Joomla.JText._(str) : fallback;
}
}, {
key: "type",
get: function get() {
return this.getAttribute('type');
},
set: function set(value) {
return this.setAttribute('type', value);
}
}, {
key: "dismiss",
get: function get() {
return this.getAttribute('dismiss');
}
}, {
key: "acknowledge",
get: function get() {
return this.getAttribute('acknowledge');
}
}, {
key: "href",
get: function get() {
return this.getAttribute('href');
}
}], [{
key: "observedAttributes",
/* Attributes to monitor */
get: function get() {
return ['type', 'dismiss', 'acknowledge', 'href'];
}
}]);
return JoomlaAlertElement;
}(_wrapNativeSuper(HTMLElement));
customElements.define('joomla-alert', JoomlaAlertElement);
})();
},{}]},{},[1]);
No other release has this exact content. See every version of this file.