[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/system/js/ -> messages-es5.min.js (source)

   1  !function(){"use strict";function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(){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=o()?Reflect.construct:function(t,e,o){var i=[null];i.push.apply(i,e);var s=new(Function.bind.apply(t,i));return o&&n(s,o.prototype),s}).apply(null,arguments)}function s(t){var o="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!==o){if(o.has(t))return o.get(t);o.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}}),n(r,t)})(t)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function u(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l=function(e){var o,i;function s(){var t;return(t=e.call(this)||this).close=t.close.bind(r(t)),t.destroyCloseButton=t.destroyCloseButton.bind(r(t)),t.createCloseButton=t.createCloseButton.bind(r(t)),t.onMutation=t.onMutation.bind(r(t)),t.observer=new MutationObserver(t.onMutation),t.observer.observe(r(t),{attributes:!1,childList:!0,subtree:!0}),t.addEventListener("animationend",(function(e){"joomla-alert-fade-in"===e.animationName&&e.target===r(t)&&(t.dispatchEvent(new CustomEvent("joomla.alert.shown")),t.style.removeProperty("animationName"))})),t.addEventListener("animationend",(function(e){"joomla-alert-fade-out"===e.animationName&&e.target===r(t)&&(t.dispatchEvent(new CustomEvent("joomla.alert.closed")),t.remove())})),t}i=e,(o=s).prototype=Object.create(i.prototype),o.prototype.constructor=o,n(o,i);var a,l,c,d=s.prototype;return d.connectedCallback=function(){this.dispatchEvent(new CustomEvent("joomla.alert.show")),this.style.animationName="joomla-alert-fade-in",this.type&&["info","warning","danger","success"].includes(this.type)||this.setAttribute("type","info"),this.role&&["alert","alertdialog"].includes(this.role)||this.setAttribute("role","alert"),this.firstElementChild&&"BUTTON"===this.firstElementChild.tagName&&(this.button=this.firstElementChild,this.button.classList.contains("joomla-alert--close")&&this.button.classList.add("joomla-alert--close"),""===this.button.innerHTML&&(this.button.innerHTML='<span aria-hidden="true">&times;</span>'),this.button.hasAttribute("aria-label")||this.button.setAttribute("aria-label",this.closeText)),this.hasAttribute("dismiss")&&!this.button&&this.createCloseButton(),this.hasAttribute("auto-dismiss")&&this.autoDismiss()},d.disconnectedCallback=function(){this.button&&this.button.removeEventListener("click",this.close),this.observer.disconnect()},d.attributeChangedCallback=function(t,e,n){switch(t){case"type":(!n||n&&-1===["info","warning","danger","success"].indexOf(n))&&(this.type="info");break;case"role":(!n||n&&-1===["alert","alertdialog"].indexOf(n))&&(this.role="alert");break;case"dismiss":n&&""!==n||e&&""!==e?this.button&&"false"===n?this.destroyCloseButton():this.button||"false"===n||this.createCloseButton():this.button&&!this.hasAttribute("dismiss")?this.destroyCloseButton():!this.button&&this.hasAttribute("dismiss")&&this.createCloseButton();break;case"close-text":n&&n===e||this.button&&this.button.setAttribute("aria-label",n);break;case"auto-dismiss":this.autoDismiss()}},d.onMutation=function(t){for(var e,n=u(t);!(e=n()).done;){var o=e.value;"childList"===o.type&&o.addedNodes.length&&this.button&&this.firstElementChild!==this.button&&this.prepend(this.button)}},d.close=function(){this.dispatchEvent(new CustomEvent("joomla.alert.close")),this.style.animationName="joomla-alert-fade-out"},d.createCloseButton=function(){this.button=document.createElement("button"),this.button.setAttribute("type","button"),this.button.classList.add("joomla-alert--close"),this.button.innerHTML='<span aria-hidden="true">&times;</span>',this.button.setAttribute("aria-label",this.closeText),this.insertAdjacentElement("afterbegin",this.button),this.button.addEventListener("click",this.close)},d.destroyCloseButton=function(){this.button&&(this.button.removeEventListener("click",this.close),this.button.parentNode.removeChild(this.button),this.button=null)},d.autoDismiss=function(){var t=parseInt(this.getAttribute("auto-dismiss"),10);setTimeout(this.close,t>=10?t:3e3)},a=s,c=[{key:"observedAttributes",get:function(){return["type","role","dismiss","auto-dismiss","close-text"]}}],(l=[{key:"type",get:function(){return this.getAttribute("type")},set:function(t){this.setAttribute("type",t)}},{key:"role",get:function(){return this.getAttribute("role")},set:function(t){this.setAttribute("role",t)}},{key:"closeText",get:function(){return this.getAttribute("close-text")},set:function(t){this.setAttribute("close-text",t)}},{key:"dismiss",get:function(){return this.getAttribute("dismiss")},set:function(t){this.setAttribute("dismiss",t)}},{key:"autodismiss",get:function(){return this.getAttribute("auto-dismiss")},set:function(t){this.setAttribute("auto-dismiss",t)}}])&&t(a.prototype,l),c&&t(a,c),Object.defineProperty(a,"prototype",{writable:!1}),s}(s(HTMLElement));customElements.get("joomla-alert")||customElements.define("joomla-alert",l);var c=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,n,o){var i=c(e);(void 0===n||n&&!1===n)&&Joomla.removeMessages(i),[].slice.call(Object.keys(t)).forEach((function(e){var n=e,s=t[e],r=document.createElement("joomla-alert");if(["success","info","danger","warning"].indexOf(e)<0&&(n="notice"===e?"info":e,n="message"===e?"success":n,n="error"===e?"danger":n,n="warning"===e?"warning":n),r.setAttribute("type",n),r.setAttribute("close-text",Joomla.Text._("JCLOSE")),r.setAttribute("dismiss",!0),o&&parseInt(o,10)>0&&r.setAttribute("auto-dismiss",o),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 u=document.createElement("div");u.className="alert-wrapper",s.forEach((function(t){u.innerHTML+=Joomla.sanitizeHtml('<div class="alert-message">'+t+"</div>")})),r.appendChild(u),i.appendChild(r)}))},Joomla.removeMessages=function(t){var e=c(t),n=[].slice.call(e.querySelectorAll("joomla-alert"));n.length&&n.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)}))}))}();


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer