CoreFiles by mySites.guru
joomla-field-permissions.min.js1 lines, 2,418 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
0fc1713ffd935ebf59160dd62a60f08e
sha1
c0ec041f9c2df6c8ed2c74b645234a69c9c75107
sha256
0bc630cc7651b8e86dcdf0d35ab0f82e85efecd4d553228ffcfef91e4f1d73b3
((e,t)=>{e.define("joomla-field-permissions",class extends HTMLElement{constructor(){if(super(),!t)throw new Error("Joomla API is not properly initiated");if(!this.getAttribute("data-uri"))throw new Error("No valid url for validation")}connectedCallback(){const e=[].slice.call(document.querySelectorAll("[data-onchange-task]"));e&&e.forEach(e=>{e.addEventListener("change",e=>{e.preventDefault(),"permissions.apply"==e.target.getAttribute("data-onchange-task")&&this.sendPermissions(e)})})}sendPermissions(e){const s=e.target,r=document.getElementById("icon_"+s.id);r.removeAttribute("class"),r.setAttribute("class","fa fa-spinner fa-spin");let a="not",o=this.getUrlParam("component"),n=this.getUrlParam("extension"),i=this.getUrlParam("option"),l=this.getUrlParam("view"),c=o,m=s.value,d="";document.getElementById("jform_context")&&(d=(d=document.getElementById("jform_context").value).split(".")[0]),"com_config"==i&&0==o&&0==n?a="root.1":0==n&&"component"==l?a=o:d?(a="group"==l?d+".fieldgroup."+this.getUrlParam("id"):d+".field."+this.getUrlParam("id"),c=document.getElementById("jform_title").value):0!=n&&0!=l?(a=n+"."+l+"."+this.getUrlParam("id"),c=document.getElementById("jform_title").value):0==n&&0!=l&&(a=i+"."+l+"."+this.getUrlParam("id"),c=document.getElementById("jform_title").value);const u=s.id.replace("jform_rules_",""),g=u.lastIndexOf("_"),f={comp:a,action:u.substring(0,g),rule:u.substring(g+1),value:m,title:c};t.removeMessages(),t.request({url:this.getAttribute("data-uri"),method:"POST",data:JSON.stringify(f),perform:!0,headers:{"Content-Type":"application/json"},onSuccess:(e,a)=>{try{e=JSON.parse(e)}catch(e){console.log(e)}if(r.removeAttribute("class"),e.data&&!0===e.data.result){r.setAttribute("class","fa fa-check");const t=s.parentNode.parentNode.nextElementSibling.querySelector("span");t.removeAttribute("class"),t.setAttribute("class",e.data.class),t.innerHTML=e.data.text}"object"==typeof e.messages&&null!==e.messages&&(t.renderMessages(e.messages),e.data&&!0===e.data.result?r.setAttribute("class","fa fa-check"):r.setAttribute("class","fa fa-times"))},onError:e=>{r.removeAttribute("style"),t.renderMessages(t.ajaxErrorsMessages(jqXHR,textStatus,error)),r.setAttribute("class","fa fa-times")}})}getUrlParam(e){const t=window.location.search.substring(1).split("&");for(let s=0;s<t.length;s+=1){let r=t[s].split("=");if(r[0]==e)return r[1]}return!1}})})(customElements,Joomla);

The same content is in 2 releases, Joomla 4.0.0-alpha3 to 4.0.0-alpha5. See them all, or every version of this file.