[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  !function(){"use strict";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:function(e){var t=document.getElementById("errorDialogLabel"),a=document.getElementById("errorDialogMessage"),o=document.getElementById("joomlaupdate-progress"),n=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"),n.classList.remove("d-none")},handleErrorResponse:function(e){var t=403===e.status,a=document.getElementById("errorDialogLabel"),o=document.getElementById("errorDialogMessage"),n=document.getElementById("joomlaupdate-progress"),r=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")),n.classList.add("d-none"),r.classList.remove("d-none")},startExtract:function(){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;var 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:function(e){try{var t=JSON.parse(e);Joomla.Update.stepExtract(t)}catch(e){Joomla.Update.genericErrorMessage(e.message)}},onError:Joomla.Update.handleErrorResponse})},stepExtract:function(e){if(!1!==e.status){var 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((function(){Joomla.Update.delayedStepExtract(e.instance)}),50)}else Joomla.Update.genericErrorMessage(e.message)},delayedStepExtract:function(e){Joomla.Update.cached_instance=e;var 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:function(e){try{var t=JSON.parse(e);Joomla.Update.stepExtract(t)}catch(e){Joomla.Update.genericErrorMessage(e.message)}},onError:Joomla.Update.handleErrorResponse})},finalizeUpdate:function(){var 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:function(){window.location=Joomla.Update.return_url},onError:Joomla.Update.handleErrorResponse})},formatBytes:function(e,t){if(void 0===t&&(t=2),0===e)return"0 "+Joomla.Text._("JLIB_SIZE_BYTES");var 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")],n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,n)).toFixed(a))+" "+o[n]},resumeButtonHandler:function(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:function(e){e.preventDefault(),document.getElementById("joomlaupdate-progress").classList.remove("d-none"),document.getElementById("joomlaupdate-error").classList.add("d-none"),Joomla.Update.startExtract()}};var e=document.getElementById("joomlaupdate-resume"),t=document.getElementById("joomlaupdate-restart");e&&e.addEventListener("click",Joomla.Update.resumeButtonHandler),t&&t.addEventListener("click",Joomla.Update.restartButtonHandler);var a=Joomla.getOptions("joomlaupdate");a&&Object.keys(a).length&&(Joomla.Update.password=a.password,Joomla.Update.totalsize=a.totalsize,Joomla.Update.ajax_url=a.ajax_url,Joomla.Update.return_url=a.return_url,Joomla.Update.startExtract())}();


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