- md5
- f07caeb6823177a34f8380e0839f6fc2
- sha1
- 79ba1238b5530785763c6d620f099b4b5e9df9f6
- sha256
- 379ac4e064be6015026ebfd1ff1450b677173bc490cf836aa06ddec4093a993b
class JoomlaFieldUser 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(t){this.setAttribute("url",t)}get modalClass(){return this.getAttribute("modal")}set modalClass(t){this.setAttribute("modal",t)}get modalWidth(){return this.getAttribute("modal-width")}set modalWidth(t){this.setAttribute("modal-width",t)}get modalHeight(){return this.getAttribute("modal-height")}set modalHeight(t){this.setAttribute("modal-height",t)}get inputId(){return this.getAttribute("input")}set inputId(t){this.setAttribute("input",t)}get inputNameClass(){return this.getAttribute("input-name")}set inputNameClass(t){this.setAttribute("input-name",t)}get buttonSelectClass(){return this.getAttribute("button-select")}set buttonSelectClass(t){this.setAttribute("button-select",t)}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 t=this.input.getAttribute("data-onchange");let e;t&&(e=new Function(t),this.input.addEventListener("change",e.bind(this.input)))}}disconnectedCallback(){this.buttonSelect.removeEventListener("click",this),this.modal.removeEventListener("hide",this)}modalOpen(){const t=this;this.removeIframe();const e=document.createElement("iframe");e.setAttribute("name","field-user-modal"),e.src=this.url.replace("{field-user-id}",this.input.getAttribute("id")),e.setAttribute("width",this.modalWidth),e.setAttribute("height",this.modalHeight),this.modalBody.appendChild(e),window.jQuery(this.modal).modal("show");const i=this.modalBody.querySelector("iframe");i.addEventListener("load",()=>{const e=i.contentWindow.document;[].slice.call(e.querySelectorAll(".button-select")).forEach(e=>{e.addEventListener("click",e=>{t.setValue(e.target.getAttribute("data-user-value"),e.target.getAttribute("data-user-name")),t.modalClose()})})})}modalClose(){window.jQuery(this.modal).modal("hide"),this.modalBody.innerHTML=""}removeIframe(){this.modalBody.innerHTML=""}setValue(t,e){this.input.setAttribute("value",t),this.inputName.setAttribute("value",e||t)}}customElements.define("joomla-field-user",JoomlaFieldUser);
No other release has this exact content. See every version of this file.