芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/ixilyucatan.gob.mx/media/plg_installer_packageinstaller/js/packageinstaller.min.js
Joomla=window.Joomla||{},(e=>{document.addEventListener("DOMContentLoaded",(()=>{if(e.submitbuttonpackage=()=>{const t=document.getElementById("adminForm");if(""===t.install_package.value)e.renderMessages({warning:[e.Text._("PLG_INSTALLER_PACKAGEINSTALLER_NO_PACKAGE")]});else if(t.install_package.files[0].size>t.max_upload_size.value)e.renderMessages({warning:[e.Text._("COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG")]});else{const e=document.getElementById("loading");e&&e.classList.remove("hidden"),t.installtype.value="upload",t.submit()}},"undefined"==typeof FormData)return document.querySelector("#legacy-uploader").classList.remove("hidden"),void document.querySelector("#uploader-wrapper").classList.add("hidden");let t=!1;const a=document.querySelector("#dragarea"),n=document.querySelector("#install_package"),r=document.querySelector("#max_upload_size").value,s=document.querySelector("#select-file-button"),o=document.querySelector("#installer-return").value,l=document.getElementById("upload-progress"),d=l.querySelector(".progress-bar"),i=l.querySelector(".uploading-number");let u="index.php?option=com_installer&task=install.ajax_upload";function c(t){a.setAttribute("data-state","pending");let n=e.Text._("PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_UNKNOWN");null==t?n=e.Text._("PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_EMPTY"):"string"==typeof t?n=t.replace(/(<([^>]+)>|\s+)/g," "):t.message&&({message:n}=t),e.renderMessages({error:[n]})}o&&(u+=`&return=${o}`),s.addEventListener("click",(()=>{n.click()})),n.addEventListener("change",(()=>{t||e.submitbuttonpackage()})),a.addEventListener("dragenter",(e=>(e.preventDefault(),e.stopPropagation(),a.classList.add("hover"),!1))),a.addEventListener("dragover",(e=>(e.preventDefault(),e.stopPropagation(),a.classList.add("hover"),!1))),a.addEventListener("dragleave",(e=>(e.preventDefault(),e.stopPropagation(),a.classList.remove("hover"),!1))),a.addEventListener("drop",(n=>{if(n.preventDefault(),n.stopPropagation(),t)return;a.classList.remove("hover");const s=n.target.files||n.dataTransfer.files;if(!s.length)return;const o=s[0],l=new FormData;if(o.size>r)return void e.renderMessages({warning:[e.Text._("COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG")]});l.append("install_package",o),l.append("installtype","upload"),a.setAttribute("data-state","uploading"),d.setAttribute("aria-valuenow",0),t=!0,d.style.width=0,i.textContent="0";const p=e=>{if(e.lengthComputable){const t=e.loaded/e.total,n=Math.round(100*t);d.style.width=`${n}%`,d.setAttribute("aria-valuenow",n),i.textContent=`${n}`,100===n&&a.setAttribute("data-state","installing")}};e.request({url:u,method:"POST",perform:!0,data:l,onBefore:e=>{e.upload.addEventListener("progress",p)},onSuccess:e=>{if(!e)return void c(e);let t;try{t=JSON.parse(e)}catch(e){return void c(e)}t.success||t.data?t.data.redirect?window.location.href=t.data.redirect:window.location.href="index.php?option=com_installer&view=install":c(t)},onError:e=>{if(t=!1,200===e.status){c(e.responseText||e.responseJSON)}else c(e.statusText)}})})),document.getElementById("installbutton_package").addEventListener("click",(t=>{t.preventDefault(),e.submitbuttonpackage()}))}))})(Joomla);