芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/tixpeual2124.gob.mx/media/system/js/fields/joomla-field-permissions.min.js
window.customElements.define("joomla-field-permissions",class extends HTMLElement{constructor(){if(super(),!Joomla)throw new Error("Joomla API is not properly initiated");if(!this.getAttribute("data-uri"))throw new Error("No valid url for validation");this.query=window.location.search.substring(1),this.buttons="",this.buttonDataSelector="data-onchange-task",this.onDropdownChange=this.onDropdownChange.bind(this),this.getUrlParam=this.getUrlParam.bind(this),this.component=this.getUrlParam("component"),this.extension=this.getUrlParam("extension"),this.option=this.getUrlParam("option"),this.view=this.getUrlParam("view"),this.asset="not",this.context=""}connectedCallback(){this.buttons=[].slice.call(document.querySelectorAll(`[${this.buttonDataSelector}]`)),this.buttons&&this.buttons.forEach((t=>{t.addEventListener("change",this.onDropdownChange)}))}disconnectedCallback(){this.buttons&&this.buttons.forEach((t=>{t.removeEventListener("change",this.onDropdownChange)}))}onDropdownChange(t){t.preventDefault();"permissions.apply"===t.target.getAttribute(this.buttonDataSelector)&&this.sendPermissions(t)}sendPermissions(t){const{target:e}=t,s=document.getElementById(`icon_${e.id}`);s.removeAttribute("class"),s.setAttribute("class","joomla-icon joomla-field-permissions__spinner");const{value:o}=e;document.getElementById("jform_context")&&(this.context=document.getElementById("jform_context").value,[this.context]=this.context.split(".")),"com_config"!==this.option||this.component||this.extension?this.extension||"component"!==this.view?this.context?("group"===this.view?this.asset=`${this.context}.fieldgroup.${this.getUrlParam("id")}`:this.asset=`${this.context}.field.{this.getUrlParam('id')}`,this.title=document.getElementById("jform_title").value):this.extension&&this.view?(this.asset=`${this.extension}.${this.view}.${this.getUrlParam("id")}`,this.title=document.getElementById("jform_title").value):!this.extension&&this.view&&(this.asset=`${this.option}.${this.view}.${this.getUrlParam("id")}`,this.title=document.getElementById("jform_title").value):this.asset=this.component:this.asset="root.1";const i=e.id.replace("jform_rules_",""),n=i.lastIndexOf("_"),a={comp:this.asset,action:i.substring(0,n),rule:i.substring(n+1),value:o,title:this.title};Joomla.removeMessages(),Joomla.request({url:this.getAttribute("data-uri"),method:"POST",data:JSON.stringify(a),perform:!0,headers:{"Content-Type":"application/json"},onSuccess:t=>{let o;try{o=JSON.parse(t)}catch(t){console.error(t)}if(s.removeAttribute("class"),o.data&&o.data.result){s.setAttribute("class","joomla-icon joomla-field-permissions__allowed");const t=e.parentNode.parentNode.nextElementSibling.querySelector("span");t.removeAttribute("class"),t.setAttribute("class",o.data.class),t.innerHTML=Joomla.sanitizeHtml(o.data.text)}"object"==typeof o.messages&&null!==o.messages&&(Joomla.renderMessages(o.messages),o.data&&o.data.result?s.setAttribute("class","joomla-icon joomla-field-permissions__allowed"):s.setAttribute("class","joomla-icon joomla-field-permissions__denied"))},onError:t=>{s.removeAttribute("style"),Joomla.renderMessages(Joomla.ajaxErrorsMessages(t,t.statusText)),s.setAttribute("class","joomla-icon joomla-field-permissions__denied")}})}getUrlParam(t){const e=this.query.split("&");let s=0;for(;s