if(typeof(akeeba)=="undefined"){var akeeba={}}if(typeof(akeeba.jQuery)=="undefined"){akeeba.jQuery=jQuery}if(typeof Solo=="undefined"){var Solo={}}if(typeof Solo.Backup=="undefined"){Solo.Backup={URLs:{},tag:"",backupid:null,translations:{},domains:{},commentEditorSave:null,maxExecutionTime:14,runtimeBias:75,srpInfo:{},returnUrl:"",isSTW:false,resume:{enabled:true,timeout:10,maxRetries:3,retry:0}}}(function(a){Solo.Backup.timer=function(b){if(b<=0){b=10}setTimeout("Solo.Backup.timerTick()",b)};Solo.Backup.timerTick=function(){try{console.log("Timer tick")}catch(b){}Solo.Backup.resetTimeoutBar();Solo.Backup.startTimeoutBar(Solo.Backup.maxExecutionTime,Solo.Backup.runtimeBias);Solo.System.doAjax({ajax:"step",tag:Solo.Backup.tag,backupid:Solo.Backup.backupid},Solo.Backup.onStep,Solo.Backup.onError,false)};Solo.Backup.startTimeoutBar=function(c,b){var d=0;a("#response-timer div.text").everyTime(1000,"lastResponse",function(){d++;var e=Solo.Backup.translations["UI-LASTRESPONSE"].replace("%s",d.toFixed(0));a("#response-timer div.text").html(e)})};Solo.Backup.resetTimeoutBar=function(){Piecon.setOptions({color:"#333333",background:"#e0e0e0",shadow:"#000000",fallback:"force"});a("#response-timer div.text").stopTime();var b=Solo.Backup.translations["UI-LASTRESPONSE"].replace("%s","0");a("#response-timer div.text").html(b)};Solo.Backup.startRetryTimeoutBar=function(){var b=Solo.Backup.resume.timeout;a("#akeeba-retry-timeout").everyTime(1000,"retryTimeout",function(){b--;a("#akeeba-retry-timeout").html(b.toFixed(0));if(b==0){a("#akeeba-retry-timeout").stopTime();Solo.Backup.resumeBackup()}})};Solo.Backup.resetRetryTimeoutBar=function(){a("#akeeba-retry-timeout").stopTime();a("#akeeba-retry-timeout").html(Solo.Backup.resume.timeout.toFixed(0))};Solo.Backup.renderBackupSteps=function(c){var b="label-success";if(c==""){b="label-default"}a("#backup-steps").html("");a.each(Solo.Backup.domains,function(d,e){var f=a(document.createElement("div")).addClass("label").html(e[1]).data("domain",e[0]).appendTo("#backup-steps");if(f.data("domain")==c){b="label-default";this_class="label-info"}else{this_class=b}f.addClass(this_class)})};Solo.Backup.start=function(){try{console.log("Starting backup");console.log(data)}catch(g){}if(window.AVGRUN){try{console.warn("AVG Antivirus with Link Checker detected. The backup WILL fail!")}catch(g){}var d=confirm(Solo.Backup.translations.SOLO_BACKUP_AVGWARNING);if(!d){return}}try{if(Solo.Backup.commentEditorSave!=null){Solo.Backup.commentEditorSave()}}catch(c){a("#comment").val("")}var f="";try{f=a("#jpskey").val()}catch(c){f=""}var h="";try{h=a("#angiekey").val()}catch(c){h=""}a("#backup-setup").hide("fast");a("#backup-progress-pane").show("fast");if(h&&(Solo.Backup.config_angiekey=="")){a("#angie-password-warning").show()}var i=new Date();Solo.System.notification.notify(Solo.Backup.translations["UI-BACKUPSTARTED"]+" "+i.toLocaleString());Solo.Backup.renderBackupSteps("");Solo.Backup.startTimeoutBar(Solo.Backup.maxExecutionTime,Solo.Backup.runtimeBias);Solo.Backup.tag=Solo.Backup.srpInfo.tag;var b={ajax:"start",description:a("#backup-description").val(),comment:a("#comment").val(),jpskey:f,angiekey:h};b=array_merge(b,Solo.Backup.srpInfo);Solo.System.doAjax(b,Solo.Backup.onStep,Solo.Backup.onError,false)};Solo.Backup.onStep=function(f){try{console.log("Running backup step");console.log(f)}catch(g){}Solo.Backup.renderBackupSteps(f.Domain);var d=f.Progress+"%";a("#backup-percentage div.bar").css({width:f.Progress+"%"});if(f.Progress>=100){Piecon.setProgress(99)}else{Piecon.setProgress(f.Progress)}a("#backup-step").html(f.Step);a("#backup-substep").html(f.Substep);if(f.Warnings.length>0){a("#backup-percentage").addClass("progress-warning");a.each(f.Warnings,function(h,j){Solo.System.notification.notify(Solo.Backup.translations["UI-BACKUPWARNING"],j);var e=a(document.createElement("div")).html(j).appendTo(a("#warnings-list"))});if(a("#backup-warnings-panel").is(":hidden")){a("#backup-warnings-panel").show("fast")}}var c=f.Error;if(c!=""){try{console.error("Got an error message");console.log(c)}catch(g){}Solo.Backup.onError(c);return}else{if(f.HasRun==1){try{console.log("Backup complete");console.log(c)}catch(g){}Solo.Backup.onDone()}else{if(empty(Solo.Backup.tag)){Solo.Backup.tag="backend"}Solo.Backup.backupid=f.backupid;Solo.Backup.resume.retry=0;var b=10;if(f.hasOwnProperty("sleepTime")){b=f.sleepTime}try{console.log("Starting tick timer with waitTime = "+b+" msec")}catch(g){}Solo.Backup.timer(b)}}};Solo.Backup.resumeBackup=function(){Solo.Backup.resetRetryTimeoutBar();a("#error-panel").hide("fast");a("#retry-panel").hide("fast");a("#backup-progress-pane").show("fast");if(a("#warnings-list").html()){a("#backup-warnings-panel").show("fast")}var b=new Date();Solo.System.notification.notify(Solo.Backup.translations["UI-BACKUPRESUME"]+" "+b.toLocaleString());Solo.Backup.timer()};Solo.Backup.cancelResume=function(){Solo.Backup.resetRetryTimeoutBar();var b=a("#backup-error-message-retry").html();Solo.Backup.endWithError(b)};Solo.Backup.onError=function(d){if(!Solo.Backup.resume.enabled){Solo.Backup.endWithError(d)}if(Solo.Backup.resume.retry>=Solo.Backup.resume.maxRetries){Solo.Backup.endWithError(d);return}Solo.Backup.resume.retry++;Solo.Backup.resetRetryTimeoutBar();var b=Solo.Backup.translations["UI-BACKUPHALT_DESC"];var c=b.replace("%d",Solo.Backup.resume.timeout.toFixed(0));Solo.System.notification.notify(Solo.Backup.translations["UI-BACKUPHALT"],c);a("#backup-progress-pane").hide("fast");a("#backup-warnings-panel").hide("fast");a("#error-panel").hide("fast");a("#backup-error-message-retry").html(d);a("#retry-panel").show("fast");Solo.Backup.startRetryTimeoutBar()};Solo.Backup.endWithError=function(c){Solo.Backup.resetTimeoutBar();try{Piecon.reset()}catch(d){}a("#backup-progress-pane").hide("fast");a("#backup-warnings-panel").hide("fast");a("#retry-panel").hide("fast");var b=Solo.Backup.URLs.LogURL+"&tag="+Solo.Backup.tag;if(Solo.Backup.backupid){b=b+"."+encodeURIComponent(Solo.Backup.backupid)}a("#ab-viewlog-error").attr("href",b);Solo.System.notification.notify(Solo.Backup.translations["UI-BACKUPFAILED"],c);Solo.System.doAjax({ajax:"pushFail",tag:Solo.Backup.tag,backupid:Solo.Backup.backupid,errorMessage:c},function(e){});a("#backup-error-message").html(c);a("#error-panel").show()};Solo.Backup.onDone=function(){var c=new Date();Solo.System.notification.notify(Solo.Backup.translations["UI-BACKUPFINISHED"]+" "+c.toLocaleString());Solo.Backup.resetTimeoutBar();try{Piecon.reset()}catch(b){}a("#backup-progress-pane").hide("fast");a("#backup-complete").show();a("#backup-warnings-panel").width("100%");if(Solo.Backup.returnUrl!=""){if(Solo.Backup.isSTW){alert(Solo.Backup.translations["UI-STW-CONTINUE"])}window.location=Solo.Backup.returnUrl}};Solo.Backup.restoreDefaultOptions=function(){a("#backup-description").val(Solo.Backup.default_descr);if(a("#angiekey").length){a("#angiekey").val(Solo.Backup.config_angiekey)}if(a("#jpskey").length){a("#jpskey").val(Solo.Backup.jpsKey)}a("#comment").val("")}}(akeeba.jQuery));