芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.6/mod_sampledata/js/sampledata-process-es5.min.js
!function(){"use strict";var e={inProgress:!1},t=function t(r,a,s){var o="index.php?option=com_ajax&format=json&group=sampledata&"+Joomla.getOptions("csrf.token")+"=1",l=Joomla.getOptions("sample-data"),n=document.createElement("div");n.classList.add("sampledata-steps-"+r+"-"+s),n.setAttribute("role","region"),n.setAttribute("aria-live","polite");var i=document.createElement("p");i.classList.add("loader-image"),i.classList.add("text-center");var d=document.createElement("img");d.setAttribute("src",l.icon),d.setAttribute("width",30),d.setAttribute("height",30),i.appendChild(d),n.appendChild(i),document.querySelector(".sampledata-progress-"+r).appendChild(n),Joomla.request({url:o+"&type="+r+"&plugin=SampledataApplyStep"+s+"&step="+s,method:"GET",perform:!0,onSuccess:function(o){var l=n.querySelector(".loader-image");l.parentNode.removeChild(l);var i={};try{i=JSON.parse(o)}catch(t){return Joomla.renderMessages({error:[Joomla.Text._("MOD_SAMPLEDATA_INVALID_RESPONSE")]},".sampledata-steps-"+r+"-"+s),void(e.inProgress=!1)}var d,c="";if(i.success&&i.data&&i.data.length>0){var m=document.querySelector(".sampledata-progress-"+r+" .progress-bar");if(i.data.forEach((function(e){null!==e&&(d=e.success,c=d?"bg-success":"bg-danger",d?Joomla.renderMessages({message:[e.message]},".sampledata-steps-"+r+"-"+s,!1,3e3):Joomla.renderMessages({error:[e.message]},".sampledata-steps-"+r+"-"+s,!1))})),m.innerText=s+"/"+a,m.style.width=s/a*100+"%",m.setAttribute("aria-valuemin",0),m.setAttribute("aria-valuemax",100),m.setAttribute("aria-valuenow",s/a*100),m.classList.add(c),d&&s<=a){var p=s+1;if(p<=a)t(r,a,p);else{var u=document.querySelector(".sampledata-progress-"+r);u.parentNode.removeChild(u),Joomla.renderMessages({message:[Joomla.Text._("MOD_SAMPLEDATA_COMPLETED")]}),window.scroll({top:0,left:0,behavior:"smooth"}),e.inProgress=!1}}}else Joomla.renderMessages({error:[Joomla.Text._("MOD_SAMPLEDATA_INVALID_RESPONSE")]}),window.scroll({top:0,left:0,behavior:"smooth"}),e.inProgress=!1},onError:function(){Joomla.renderMessages({error:["Something went wrong! Please close and reopen the browser and try again!"]}),window.scroll({top:0,left:0,behavior:"smooth"}),e.inProgress=!1}})},r=function(r){var a=r.getAttribute("data-type"),s=r.getAttribute("data-steps");if(!e.inProgress)return r.getAttribute("data-processed")?(alert(Joomla.Text._("MOD_SAMPLEDATA_ITEM_ALREADY_PROCESSED")),void(e.inProgress=!1)):!!window.confirm(Joomla.Text._("MOD_SAMPLEDATA_CONFIRM_START"))&&([].slice.call(document.querySelectorAll(".sampledata-progress-"+a)).forEach((function(e){e.classList.remove("d-none")})),r.getAttribute("data-processed",!0),e.inProgress=!0,t(a,s,1),!1)},a=document.getElementById("sample-data-wrapper");a&&[].slice.call(a.querySelectorAll(".apply-sample-data")).forEach((function(e){e.addEventListener("click",(function(e){var t=e.currentTarget;return r(t)}))}))}();