HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/lacalita/wp-content/plugins/rey-core/assets/js/lib/importer.js
!function(){"use strict";var t=function(t,s,r){this.demoData={},this.modal=null,this.modalContent=null,this.steps={},this.formData={plugins:[],content:[]},this.init=function(){this.id=t,this.btn=r,r.classList.add("--loading"),rey.ajax.request("import_get_demo",{data:{demo:t},cb:t=>{if(t.data){if(this.demoData=t.data,this.demoData.error)return console.log(this.demoData.error),void document.querySelectorAll(".rey-adminBtn[data-import-item]").forEach((t=>{t.classList.remove("--loading"),t.classList.add("--disabled")}));this.setupModal(),this.open(),this.events(),r.classList.remove("--loading")}else console.log("Cannot retrieve demo data.")}})},this.events=function(){var t=this.wrapper.querySelector(".rey-import-configureForm");t&&(t.addEventListener("submit",(s=>{(s.preventDefault(),t.classList.contains("--prevent-submit"))||(s.target.querySelectorAll('input[name="import-plugins"]:checked').forEach((t=>{this.formData.plugins.push(t.value)})),s.target.querySelectorAll('input[name="import-content"]:checked').forEach((t=>{this.formData.content.push(t.value)})),s.target.querySelector('input[name="reset-content"]:checked')&&(this.formData.reset=1),this.modal.setPreventClose(!0),this.steps.configure.classList.add("--back"),setTimeout((()=>{this.steps.configure.style.display="none",this.steps.runner.style.display="block",setTimeout((()=>{this.steps.runner.classList.add("--active")}),50)}),300),new e(this))})),this.wrapper.querySelectorAll('input[name="import-content"]').forEach((e=>{e.addEventListener("change",(e=>{t.classList.toggle("--prevent-submit",!this.wrapper.querySelectorAll('input[name="import-content"]:checked').length)}))})),this.logToggler&&this.logToggler.addEventListener("click",(t=>{t.preventDefault(),this.logToggler.parentElement.classList.toggle("--active")})),this.exitButton&&this.exitButton.addEventListener("click",(t=>{t.preventDefault(),this.modal.close()})),this.copyLog&&this.logBox&&this.copyLog.addEventListener("click",(t=>{t.preventDefault(),this.logBox.select(),document.execCommand("copy"),t.currentTarget.style.opacity="0.5"})))},this.setupModal=function(){this.modal||(this.modalContent=s(this.demoData),"undefined"!=typeof ReyModal?(this.modal=new ReyModal({linkAttributeName:!1,catchFocus:!1,closeOnEsc:!0,backscroll:!0,beforeOpen:t=>{this.beforeOpen(t)},afterClose:t=>{this.afterClose(t)}}),this.modal.init()):console.log("Modal is undefined."))},this.beforeOpen=function(t){this.wrapper=t.$content.querySelector(".rey-import-modal"),this.wrapper&&(this.wrapper.classList.remove("--hidden"),this.steps.configure=this.wrapper.querySelector('.__step[data-step="configure"]'),this.steps.runner=this.wrapper.querySelector('.__step[data-step="runner"]'),this.importBtn=this.wrapper.querySelector(".__run"),this.logToggler=this.wrapper.querySelector(".__log-toggle"),this.logBox=this.wrapper.querySelector(".__log-box"),this.copyLog=this.wrapper.querySelector(".__log-copy"),this.statusBox=this.wrapper.querySelector(".__status[data-status-text]"),this.progressBar=this.wrapper.querySelector(".__progress .__bar"),this.progressPerc=this.wrapper.querySelector(".__progress .__perc"),this.successBox=this.wrapper.querySelector(".__success"),this.runnerTitle=this.steps.runner.querySelector(".__header h2"),this.exitButton=this.steps.runner.querySelector(".__exit"),this.steps.configure.style.display="block")},this.afterClose=function(t){this.steps.configure.classList.remove("--back"),this.steps.configure.classList.add("--active"),this.steps.configure.style.display="block",this.steps.runner.classList.remove("--active"),this.steps.runner.style.display="none",this.modal.setPreventClose(!1)},this.open=function(){this.modal&&this.modal.open({width:495,type:"html",content:this.modalContent,wrapperClass:"rey-importer-modalWrapper",id:"im-"+t,closePosition:"outside"})},this.init()},e=function(t){this.data={},this.fraction=null,this.progress=0,this.init=function(){window.isImporting=!0,this.logger=t.logBox,this.data.config=t.formData,this.data.config.demo=t.demoData.slug,this.data.config.name=t.demoData.name,this.data.task="init",this.setStatus(reyImportParams.text.init),this.request()},this.handleNext=function(){this.log(),this.finished()||(this.data.status&&delete this.data.status,this.request())},this.request=function(){rey.ajax.request("run_import",{data:this.data||{},cb:e=>{if(this.data=e.data,this.data.error)return this.setStatus(this.data.error,"Error:"),t.runnerTitle&&(t.runnerTitle.textContent=reyImportParams.text.failed_title),void(this.data.revert&&(t.runnerTitle&&(t.runnerTitle.textContent+=" ",t.runnerTitle.textContent+=reyImportParams.text.failed_reset),this.handleRevert()));this.calculateFractions(),this.setStatus(),this.runProgress(),setTimeout((()=>{this.handleNext()}),parseInt(reyImportParams.timeout)||10)}})},this.log=function(t){var e;this.logger&&(this.data.error?e=this.data.error:this.data.status&&(e=this.data.status),this.logger.textContent+=(t||e)+"\n",this.data.notices&&(this.logger.textContent+=this.data.notices+"\n"),this.logger.scrollTo({top:this.logger.scrollHeight}),delete this.data.notices)},this.finished=function(){return!this.data.task&&(this.log(reyImportParams.text.finished),t.runnerTitle&&(t.runnerTitle.textContent=`${reyImportParams.text.finished_title} ${t.demoData.name}`),window.isImporting=!1,t.modal.setPreventClose(!1),this.setStatus(reyImportParams.text.finished_status),this.setProgress(100),t.wrapper.classList.add("--success"),!0)},this.setStatus=function(e,s){t.statusBox&&(s&&t.statusBox.setAttribute("data-status-type",s),t.statusBox.setAttribute("data-status-text",e||this.data.status))},this.runProgress=function(){void 0!==this.data.task&&(this.data.offset&&"install-plugins"!==this.data.task||(this.progress+=this.fraction,this.setProgress()))},this.setProgress=function(e){var s=Math.min(100,Math.floor(e||this.progress));t.progressBar&&t.progressBar.style.setProperty("--progress",s),t.progressPerc&&t.progressPerc.setAttribute("data-progress",s)},this.calculateFractions=function(){this.fraction||(this.fraction=100/parseInt(this.data.fractions))},this.handleRevert=function(){var e=t.wrapper.querySelector(".__progress");e&&(e.style.display="none"),rey.ajax.request("run_import_reset",{cb:e=>{console.log("Reseting",e.data),window.isImporting=!1,t.modal.setPreventClose(!1)}})},this.init()};new function(){this.modals={},this.init=function(){this.wrapper=document.querySelector('.rey-itemManager-wrapper[data-type="importer"]'),this.wrapper&&(this.modalTemplate=rey.template("rey-demo-import-modal"),this.modalTemplate&&(this.resetBtn=document.querySelector(".__importer-reset[data-demo-name]"),this.refreshBtn=document.querySelector(".__importer-refresh"),this.events()))},this.events=function(){this.wrapper.querySelectorAll(".rey-adminBtn[data-import-item], .rey-itemManager-media[data-import-item]").forEach((e=>{e.addEventListener("click",(s=>{s.preventDefault();var r=e.getAttribute("data-import-item");this.modals[r]?this.modals[r].open():this.modals[r]=new t(r,this.modalTemplate,e)}))})),window.addEventListener("beforeunload",(t=>{if(window.isImporting)return t.preventDefault(),t.returnValue="","Is importing"}),!0),this.resetBtn&&this.resetBtn.addEventListener("click",(t=>{t.preventDefault();var e=t.currentTarget.getAttribute("data-demo-name");confirm(`Are you sure you want to reset the "${e}" data?`)&&(this.resetBtn.classList.add("disabled","--loading"),rey.ajax.request("run_import_reset",{cb:t=>{console.log("Reset: "+t.data),t.data.error||(this.resetBtn.textContent=reyImportParams.text.reloading,setTimeout((()=>{location.reload()}),1e3))}}))})),this.refreshBtn&&this.refreshBtn.addEventListener("click",(t=>{t.preventDefault(),this.refreshBtn.classList.add("--loading"),rey.ajax.request("run_demos_refresh",{cb:t=>{t.data&&(this.refreshBtn.textContent=reyImportParams.text.reloading,setTimeout((()=>{location.reload()}),1e3))}})}))},this.init()}}();