- md5
- 886872b23dff429c5273d49df5472fff
- sha1
- 1ef846a9d4e8f8b4149b1ee164497136456ec773
- sha256
- d83aaf352109226caefb3fe15976f6fbc555483b365eeee3b789327f6aa6c91f
"use strict";(a=>{class b extends HTMLElement{static get observedAttributes(){return["url","modal-class","modal-width","modal-height","input","input-name","button-select"]}get url(){return this.getAttribute("url")}set url(a){this.setAttribute("url",a)}get modalClass(){return this.getAttribute("modal")}set modalClass(a){this.setAttribute("modal",a)}get modalWidth(){return this.getAttribute("modal-width")}set modalWidth(a){this.setAttribute("modal-width",a)}get modalHeight(){return this.getAttribute("modal-height")}set modalHeight(a){this.setAttribute("modal-height",a)}get inputId(){return this.getAttribute("input")}set inputId(a){this.setAttribute("input",a)}get inputNameClass(){return this.getAttribute("input-name")}set inputNameClass(a){this.setAttribute("input-name",a)}get buttonSelectClass(){return this.getAttribute("button-select")}set buttonSelectClass(a){this.setAttribute("button-select",a)}connectedCallback(){if(this.modal=this.querySelector(this.modalClass),this.modalBody=this.querySelector(".modal-body"),this.input=this.querySelector(this.inputId),this.inputName=this.querySelector(this.inputNameClass),this.buttonSelect=this.querySelector(this.buttonSelectClass),this.modalClose=this.modalClose.bind(this),this.setValue=this.setValue.bind(this),this.buttonSelect){this.buttonSelect.addEventListener("click",this.modalOpen.bind(this)),this.modal.addEventListener("hide",this.removeIframe.bind(this));const a=this.input.getAttribute("data-onchange");let b;a&&(b=new Function(a),this.input.addEventListener("change",b.bind(this.input)))}}disconnectedCallback(){this.buttonSelect.removeEventListener("click",this),this.modal.removeEventListener("hide",this)}modalOpen(){const a=this;this.removeIframe();const b=document.createElement("iframe");b.setAttribute("name","field-user-modal"),b.src=this.url.replace("{field-user-id}",this.input.getAttribute("id")),b.setAttribute("width",this.modalWidth),b.setAttribute("height",this.modalHeight),this.modalBody.appendChild(b),this.modal.open();const c=this.modalBody.querySelector("iframe");c.addEventListener("load",()=>{const b=c.contentWindow.document,d=[].slice.call(b.querySelectorAll(".button-select"));d.forEach(b=>{b.addEventListener("click",b=>{a.setValue(b.target.getAttribute("data-user-value"),b.target.getAttribute("data-user-name")),a.modalClose()})})})}modalClose(){Joomla.Modal.getCurrent().close(),this.modalBody.innerHTML=""}removeIframe(){this.modalBody.innerHTML=""}setValue(a,b){this.input.setAttribute("value",a),this.inputName.setAttribute("value",b||a)}}a.define("joomla-field-user",b)})(customElements);
No other release has this exact content. See every version of this file.