- md5
- a9c8fb5fc58b0b7e3b7e3fc8a815cc88
- sha1
- 2d82418960736112da3aed4c6935e94a154c01d0
- sha256
- 897925aefe9c8faa5d127b8d33df388870c9501496d18f3932a61e1851fb0fae
!function(){"use strict";function t(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function i(t,e,s){return(i=n()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var s=new(Function.bind.apply(t,i));return n&&o(s,n.prototype),s}).apply(null,arguments)}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||(s=t,-1===Function.toString.call(s).indexOf("[native code]")))return t;var s;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return i(t,arguments,e(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}var r;r=function(e){var n,i;function s(){return e.apply(this,arguments)||this}i=e,(n=s).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var r,a,l,c=s.prototype;return c.connectedCallback=function(){this.classList.add("joomla-alert--show"),this.type&&-1!==["info","warning","danger","success"].indexOf(this.type)||this.setAttribute("type","info"),this.role&&-1!==["alert","alertdialog"].indexOf(this.role)||this.setAttribute("role","alert"),(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.hasAttribute("auto-dismiss")&&this.autoDismiss(),this.dispatchCustomEvent("joomla.alert.show")},c.disconnectedCallback=function(){this.removeEventListener("joomla.alert.show",this),this.removeEventListener("joomla.alert.close",this),this.removeEventListener("joomla.alert.closed",this),this.firstChild.tagName&&"button"===this.firstChild.tagName.toLowerCase()&&this.firstChild.removeEventListener("click",this)},c.attributeChangedCallback=function(t,e,o){switch(t){case"type":(!o||o&&-1===["info","warning","danger","success"].indexOf(o))&&(this.type="info");break;case"role":(!o||o&&-1===["alert","alertdialog"].indexOf(o))&&(this.role="alert");break;case"dismiss":case"acknowledge":o&&"true"!==o?this.removeCloseButton():this.appendCloseButton();break;case"auto-dismiss":this.autoDismiss();break;case"href":o&&""!==o?this.querySelector("button.joomla-alert-button--close")||this.appendCloseButton():this.removeCloseButton()}},c.markAlertClosed=function(t){this.dispatchCustomEvent("joomla.alert.closed"),t?t.parentNode.removeChild(t):this.remove()},c.close=function(t){var e=this;void 0===t&&(t=null),this.dispatchCustomEvent("joomla.alert.close"),window.matchMedia("(prefers-reduced-motion)").matches?this.markAlertClosed(t):this.addEventListener("transitionend",(function(){return e.markAlertClosed(t)}),!1),this.classList.remove("joomla-alert--show")},c.dispatchCustomEvent=function(t){var e=new CustomEvent(t);e.relatedTarget=this,this.dispatchEvent(e),this.removeEventListener(t,this)},c.appendCloseButton=function(){if(!this.querySelector("button.joomla-alert--close")&&!this.querySelector("button.joomla-alert-button--close")){var t=this,e=document.createElement("button");this.hasAttribute("dismiss")?(e.classList.add("joomla-alert--close"),e.innerHTML='<span aria-hidden="true">×</span>',e.setAttribute("aria-label",this.getText("JCLOSE","Close"))):(e.classList.add("joomla-alert-button--close"),this.hasAttribute("acknowledge")?e.innerHTML=this.getText("JOK","ok"):e.innerHTML=this.getText("JOPEN","Open")),this.firstChild?this.insertBefore(e,this.firstChild):this.appendChild(e),e&&(this.href?e.addEventListener("click",(function(){t.dispatchCustomEvent("joomla.alert.buttonClicked"),window.location.href=t.href,t.close()})):e.addEventListener("click",(function(){t.dispatchCustomEvent("joomla.alert.buttonClicked"),t.getAttribute("data-callback")?(window[t.getAttribute("data-callback")](),t.close()):t.close()})))}},c.autoDismiss=function(){var t=this;setTimeout((function(){t.dispatchCustomEvent("joomla.alert.buttonClicked"),t.hasAttribute("data-callback")?window[t.getAttribute("data-callback")]():t.close(t)}),parseInt(t.getAttribute("auto-dismiss"),10)?t.getAttribute("auto-dismiss"):3e3)},c.removeCloseButton=function(){var t=this.querySelector("button");t&&(t.removeEventListener("click",this),t.parentNode.removeChild(t))},c.getText=function(t,e){return window.Joomla&&Joomla.JText&&Joomla.JText._&&"function"==typeof Joomla.JText._&&Joomla.JText._(t)?Joomla.JText._(t):e},r=s,l=[{key:"observedAttributes",get:function(){return["type","role","dismiss","acknowledge","href"]}}],(a=[{key:"type",get:function(){return this.getAttribute("type")},set:function(t){return this.setAttribute("type",t)}},{key:"role",get:function(){return this.getAttribute("role")},set:function(t){return this.setAttribute("role",t)}},{key:"dismiss",get:function(){return this.getAttribute("dismiss")}},{key:"autodismiss",get:function(){return this.getAttribute("auto-dismiss")}},{key:"acknowledge",get:function(){return this.getAttribute("acknowledge")}},{key:"href",get:function(){return this.getAttribute("href")}}])&&t(r.prototype,a),l&&t(r,l),s}(s(HTMLElement)),customElements.define("joomla-alert",r);var a=function(t){return t instanceof HTMLElement?t:void 0===t||t&&"#system-message-container"===t?document.getElementById("system-message-container"):document.querySelector(t)};Joomla.renderMessages=function(t,e,o,n){var i=a(e);(void 0===o||o&&!1===o)&&Joomla.removeMessages(i),[].slice.call(Object.keys(t)).forEach((function(e){var o=e,s=t[e],r=document.createElement("joomla-alert");if(["success","info","danger","warning"].indexOf(e)<0&&(o="notice"===e?"info":e,o="message"===e?"success":o,o="error"===e?"danger":o,o="warning"===e?"warning":o),r.setAttribute("type",o),r.setAttribute("dismiss",!0),n&&parseInt(n,10)>0&&r.setAttribute("auto-dismiss",n),void 0!==Joomla.Text._(e)){var a=document.createElement("div");a.className="alert-heading",a.innerHTML=Joomla.sanitizeHtml('<span class="'+e+'"></span><span class="visually-hidden">'+(Joomla.Text._(e)?Joomla.Text._(e):e)+"</span>"),r.appendChild(a)}var l=document.createElement("div");l.className="alert-wrapper",s.forEach((function(t){l.innerHTML+=Joomla.sanitizeHtml('<div class="alert-message">'+t+"</div>")})),r.appendChild(l),i.appendChild(r)}))},Joomla.removeMessages=function(t){var e=a(t),o=[].slice.call(e.querySelectorAll("joomla-alert"));o.length&&o.forEach((function(t){t.close()}))},document.addEventListener("DOMContentLoaded",(function(){var t=Joomla.getOptions("joomla.messages");t&&Object.keys(t).map((function(e){return Joomla.renderMessages(t[e],void 0,!0,void 0)}))}))}();
The same content is in 4 releases, Joomla 4.0.0-rc1 to 4.0.0-rc4. See them all, or every version of this file.