- md5
- 9b84d303e9f2c341ac3429ff21c89f74
- sha1
- c9a8b17e82af1b23920000cc5cb2f64c2aa5e180
- sha256
- 93b05bed768bf415a904440137a227fec70f12d1d55782db71d3304998ab2316
((a,b,c)=>{'use strict';c.SampleData={inProgress:!1},c.sampledataAjax=(a,d,f)=>{const g=`index.php?option=com_ajax&format=json&group=sampledata&${c.getOptions("csrf.token")}=1`,h=c.getOptions("sample-data"),i=b.createElement("li");i.classList.add(`sampledata-steps-${a}-${f}`);const j=b.createElement("p");j.classList.add("loader-image"),j.classList.add("text-center");const k=b.createElement("img");k.setAttribute("src",h.icon),k.setAttribute("width",30),k.setAttribute("height",30),j.appendChild(k),i.appendChild(j),b.querySelector(`.sampledata-progress-${a} ul`).appendChild(i),c.request({url:`${g}&type=${a}&plugin=SampledataApplyStep${f}&step=${f}`,method:"GET",perform:!0,onSuccess:e=>{const g=i.querySelector(".loader-image");g.parentNode.removeChild(g);let h={};try{h=JSON.parse(e)}catch(b){return c.renderMessages({error:[c.JText._("MOD_SAMPLEDATA_INVALID_RESPONSE")]},`.sampledata-steps-${a}-${f}`),void(c.SampleData.inProgress=!1)}let j,k="";if(h.success&&h.data&&0<h.data.length){const e=b.querySelector(`.sampledata-progress-${a} .progress-bar`);if(h.data.forEach(b=>{null===b||(j=b.success,k=j?"bg-success":"bg-danger",j?c.renderMessages({message:[b.message]},`.sampledata-steps-${a}-${f}`):c.renderMessages({error:[b.message]},`.sampledata-steps-${a}-${f}`))}),e.innerText=`${f}/${d}`,e.style.width=`${100*(f/d)}%`,e.setAttribute("aria-valuemin",0),e.setAttribute("aria-valuemax",100),e.setAttribute("aria-valuenow",100*(f/d)),e.classList.add(k),j&&f<=d){const b=f+1;b<=d&&c.sampledataAjax(a,d,b)}}else c.renderMessages({error:[c.JText._("MOD_SAMPLEDATA_INVALID_RESPONSE")]},`.sampledata-steps-${a}-${f}`),c.SampleData.inProgress=!1},onError:()=>{alert("Something went wrong! Please close and reopen the browser and try again!")}})},c.sampledataApply=d=>{const e=d.getAttribute("data-type"),f=d.getAttribute("data-steps");if(!c.SampleData.inProgress){if(d.getAttribute("data-processed"))return void alert(c.JText._("MOD_SAMPLEDATA_ITEM_ALREADY_PROCESSED"));if(!a.confirm(c.JText._("MOD_SAMPLEDATA_CONFIRM_START")))return!1;const g=[].slice.call(b.querySelectorAll(`.sampledata-progress-${e}`));return g.forEach(a=>{a.classList.remove("d-none")}),d.getAttribute("data-processed",!0),c.SampleData.inProgress=!0,c.sampledataAjax(e,f,1),!1}};const d=()=>{const a=b.getElementById("sample-data-wrapper");if(a){const b=[].slice.call(a.querySelectorAll(".apply-sample-data"));b.forEach(a=>{a.addEventListener("click",({target:a})=>c.sampledataApply(a))})}b.removeEventListener("DOMContentLoaded",d)};b.addEventListener("DOMContentLoaded",d)})(window,document,window.Joomla);
The same content is in 7 releases, Joomla 4.0.0-beta to 4.0.0-beta7. See them all, or every version of this file.