[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_joomlaupdate/js/ -> admin-update-default.min.js (source)

   1  if(!Joomla)throw new Error("Joomla API was not initialised properly");Joomla.Update=window.Joomla.Update||{stat_total:0,stat_files:0,stat_inbytes:0,stat_outbytes:0,password:null,totalsize:0,ajax_url:null,return_url:null,cached_instance:null,genericErrorMessage:e=>{const t=document.getElementById("errorDialogLabel"),a=document.getElementById("errorDialogMessage"),o=document.getElementById("joomlaupdate-progress"),s=document.getElementById("joomlaupdate-error");t.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_ERRORMODAL_HEAD_GENERIC"),a.innerHTML=e,"invalid login"===e.toLowerCase()&&(a.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_ERRORMODAL_BODY_INVALIDLOGIN")),o.classList.add("d-none"),s.classList.remove("d-none")},handleErrorResponse:e=>{const t=403===e.status,a=document.getElementById("errorDialogLabel"),o=document.getElementById("errorDialogMessage"),s=document.getElementById("joomlaupdate-progress"),l=document.getElementById("joomlaupdate-error");t?(a.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_ERRORMODAL_HEAD_FORBIDDEN"),o.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_ERRORMODAL_BODY_FORBIDDEN")):(a.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_ERRORMODAL_HEAD_SERVERERROR"),o.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_ERRORMODAL_BODY_SERVERERROR")),s.classList.add("d-none"),l.classList.remove("d-none")},startExtract:()=>{Joomla.Update.stat_files=0,Joomla.Update.stat_inbytes=0,Joomla.Update.stat_outbytes=0,Joomla.Update.cached_instance=null,document.getElementById("extbytesin").innerText=Joomla.Update.formatBytes(Joomla.Update.stat_inbytes),document.getElementById("extbytesout").innerText=Joomla.Update.formatBytes(Joomla.Update.stat_outbytes),document.getElementById("extfiles").innerText=Joomla.Update.stat_files;const e=new FormData;e.append("task","startExtract"),e.append("password",Joomla.Update.password),Joomla.request({url:Joomla.Update.ajax_url,data:e,method:"POST",perform:!0,onSuccess:e=>{try{const t=JSON.parse(e);Joomla.Update.stepExtract(t)}catch(e){Joomla.Update.genericErrorMessage(e.message)}},onError:Joomla.Update.handleErrorResponse})},stepExtract:e=>{if(!1===e.status)return void Joomla.Update.genericErrorMessage(e.message);const t=document.getElementById("progress-bar"),a=document.getElementById("update-title");if(Joomla.Update.stat_inbytes=e.bytesIn,Joomla.Update.stat_percent=e.percent,Joomla.Update.stat_percent=Joomla.Update.stat_percent||Joomla.Update.stat_inbytes/Joomla.Update.totalsize*100,Joomla.Update.stat_outbytes=e.bytesOut,Joomla.Update.stat_files=e.files,Joomla.Update.stat_percent<100?(t.classList.remove("bg-success"),t.style.width=`$Joomla.Update.stat_percent}%`,t.setAttribute("aria-valuenow",Joomla.Update.stat_percent)):Joomla.Update.stat_percent>=100&&(t.classList.add("bg-success"),t.style.width="100%",t.setAttribute("aria-valuenow",100)),t.innerText=`$Joomla.Update.stat_percent.toFixed(1)}%`,document.getElementById("extbytesin").innerText=Joomla.Update.formatBytes(Joomla.Update.stat_inbytes),document.getElementById("extbytesout").innerText=Joomla.Update.formatBytes(Joomla.Update.stat_outbytes),document.getElementById("extfiles").innerText=Joomla.Update.stat_files,e.done)return t.classList.add("bg-success"),t.style.width="100%",t.setAttribute("aria-valuenow",100),a.innerHTML=Joomla.Text._("COM_JOOMLAUPDATE_UPDATING_COMPLETE"),void Joomla.Update.finalizeUpdate();window.setTimeout((()=>{Joomla.Update.delayedStepExtract(e.instance)}),50)},delayedStepExtract:e=>{Joomla.Update.cached_instance=e;const t=new FormData;t.append("task","stepExtract"),t.append("password",Joomla.Update.password),e&&t.append("instance",e),Joomla.request({url:Joomla.Update.ajax_url,data:t,method:"POST",perform:!0,onSuccess:e=>{try{const t=JSON.parse(e);Joomla.Update.stepExtract(t)}catch(e){Joomla.Update.genericErrorMessage(e.message)}},onError:Joomla.Update.handleErrorResponse})},finalizeUpdate:()=>{const e=new FormData;e.append("task","finalizeUpdate"),e.append("password",Joomla.Update.password),Joomla.request({url:Joomla.Update.ajax_url,data:e,method:"POST",perform:!0,onSuccess:()=>{window.location=Joomla.Update.return_url},onError:Joomla.Update.handleErrorResponse})},formatBytes:(e,t=2)=>{if(0===e)return`0 $Joomla.Text._("JLIB_SIZE_BYTES")}`;const a=t<0?0:t,o=[Joomla.Text._("JLIB_SIZE_BYTES"),Joomla.Text._("JLIB_SIZE_KB"),Joomla.Text._("JLIB_SIZE_MB"),Joomla.Text._("JLIB_SIZE_GB"),Joomla.Text._("JLIB_SIZE_TB"),Joomla.Text._("JLIB_SIZE_PB"),Joomla.Text._("JLIB_SIZE_EB"),Joomla.Text._("JLIB_SIZE_ZB"),Joomla.Text._("JLIB_SIZE_YB")],s=Math.floor(Math.log(e)/Math.log(1024));return`$parseFloat((e/1024**s).toFixed(a))} $o[s]}`},resumeButtonHandler:e=>{e.preventDefault(),document.getElementById("joomlaupdate-progress").classList.remove("d-none"),document.getElementById("joomlaupdate-error").classList.add("d-none"),!1===Joomla.Update.cached_instance?Joomla.Update.startExtract():Joomla.Update.delayedStepExtract(Joomla.Update.cached_instance)},restartButtonHandler:e=>{e.preventDefault(),document.getElementById("joomlaupdate-progress").classList.remove("d-none"),document.getElementById("joomlaupdate-error").classList.add("d-none"),Joomla.Update.startExtract()}};const elResume=document.getElementById("joomlaupdate-resume"),elRestart=document.getElementById("joomlaupdate-restart");elResume&&elResume.addEventListener("click",Joomla.Update.resumeButtonHandler),elRestart&&elRestart.addEventListener("click",Joomla.Update.restartButtonHandler);const JoomlaUpdateOptions=Joomla.getOptions("joomlaupdate");JoomlaUpdateOptions&&Object.keys(JoomlaUpdateOptions).length&&(Joomla.Update.password=JoomlaUpdateOptions.password,Joomla.Update.totalsize=JoomlaUpdateOptions.totalsize,Joomla.Update.ajax_url=JoomlaUpdateOptions.ajax_url,Joomla.Update.return_url=JoomlaUpdateOptions.return_url,Joomla.Update.startExtract());


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer