芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/cansahcab.gob.mx/media/com_languages/js/overrider.min.js
((e,s)=>{class t{constructor(){this.states={refreshing:!1,refreshed:!1,counter:0,searchString:"",searchType:"value"},this.spinner=s.getElementById("overrider-spinner"),this.spinnerBtn=s.getElementById("overrider-spinner-btn"),this.moreResults=s.getElementById("more-results"),this.moreResultsButton=s.getElementById("more-results-button"),this.resultsContainer=s.getElementById("results-container"),this.refreshStatus=s.getElementById("refresh-status")}refreshCache(){this.states.refreshing=!0,this.refreshStatus.classList.add("show"),e.request({url:"index.php?option=com_languages&task=strings.refresh&format=json",method:"POST",headers:{"Content-Type":"application/json"},onSuccess:s=>{s.error&&s.message&&alert(s.message),s.messages&&e.renderMessages(s.messages),this.refreshStatus.classList.remove("show"),this.states.refreshing=!1},onError:()=>{alert(e.Text._("COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR")),this.refreshStatus.classList.remove("show")}})}searchStrings(t){if(this.states.refreshing)return;const r=s.getElementById("jform_searchstring"),i=s.getElementById("jform_searchtype");if(!t){this.states.searchString=r.value,this.states.searchType=i.value||"value";[].slice.call(s.querySelectorAll(".language-results")).forEach((e=>{e.parentNode.removeChild(e)}))}if(this.states.searchString){if(t)this.spinnerBtn.classList.add("show");else{this.moreResults.classList.remove("show");[].slice.call(s.querySelectorAll("#results-container div.language-results")).forEach((e=>{e.parentNode.removeChild(e)})),this.resultsContainer.classList.add("show"),this.spinner.classList.add("show")}e.request({url:`index.php?option=com_languages&task=strings.search&format=json&searchstring=${this.states.searchString}&searchtype=${this.states.searchType}&more=${t}`,method:"POST",headers:{"Content-Type":"application/json"},onSuccess:s=>{const t=JSON.parse(s);t.error&&t.message&&alert(t.message),t.messages&&e.renderMessages(t.messages),t.data&&(t.data.results&&e.overrider.insertResults(t.data.results),t.data.more?(this.states.more=t.data.more,this.moreResultsButton.disabled=!1,this.moreResults.classList.add("show")):(this.moreResultsButton.disabled=!0,this.moreResults.classList.remove("show"))),this.spinnerBtn.classList.remove("show"),this.spinner.classList.remove("show")},onError:()=>{alert(e.Text._("COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR")),this.moreResultsButton.disabled=!0,this.moreResults.classList.remove("show"),this.resultsContainer.classList.remove("show")}})}else r.classList.add("invalid")}insertResults(t){this.states.counter+=1;const r=s.createElement("div");if(r.setAttribute("id",`language-results${this.states.counter}`),r.classList.add("language-results"),r.classList.add("list-group"),r.classList.add("mb-2"),r.classList.add("show"),t.forEach(((t,i)=>{const a=s.createElement("a");a.setAttribute("onclick",`Joomla.overrider.selectString(${this.states.counter}${i});`),a.setAttribute("href","#"),a.classList.add("list-group-item"),a.classList.add("list-group-item-action"),a.classList.add("flex-column"),a.classList.add("align-items-start");const n=s.createElement("div");n.setAttribute("id",`override_key${this.states.counter}${i}`),n.setAttribute("title",t.file),n.classList.add("result-key"),n.innerHTML=e.sanitizeHtml(t.constant);const l=s.createElement("div");l.setAttribute("id",`override_string${this.states.counter}${i}`),l.classList.add("result-string"),l.innerHTML=e.sanitizeHtml(t.string),a.appendChild(n),a.appendChild(l),r.appendChild(a)})),!t.length){const t=s.createElement("div");t.innerText=e.Text._("COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS"),r.appendChild(t)}this.moreResults&&this.moreResults.parentNode.insertBefore(r,this.moreResults)}selectString(e){s.getElementById("jform_key").value=s.getElementById(`override_key${e}`).innerHTML,s.getElementById("jform_override").value=s.getElementById(`override_string${e}`).innerHTML}}s.addEventListener("DOMContentLoaded",(()=>{e.overrider=new t}))})(Joomla,document);