function aj_step(e){var t=jQuery("#aj_nonce").val(),a=jQuery("#aj_gtmetrix_username").val(),s=jQuery("#aj_gtmetrix_api_key").val(),r=jQuery("#aj_gtmetrix_server").val();if("aj_step_results"==e){var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:a,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:t};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(e=jQuery.parseJSON(e),e.status!==!1){var t=e.baseline_pagespeed,a=e.baseline_yslow,s=e.results.pagespeed_score,r=e.results.yslow_score,_=e.name,i=parseFloat(e.results.fully_loaded_time/1e3).toFixed(2),j=e.url;jQuery(".aj_gtmetrix_config").html(_),s>t?jQuery("#aj_gtmetrix_inde_pagespeed").html("an increase"):t>s?jQuery("#aj_gtmetrix_inde_pagespeed").html("a decrease"):jQuery("#aj_gtmetrix_inde_pagespeed").html("no change"),r>a?jQuery("#aj_gtmetrix_inde_yslow").html("an increase"):a>r?jQuery("#aj_gtmetrix_inde_yslow").html("a decrease"):jQuery("#aj_gtmetrix_inde_yslow").html("no change"),jQuery("#aj_gtmetrix_baseline_pagespeed").html(t+"%"),jQuery("#aj_gtmetrix_best_pagespeed").html(s+"%"),jQuery("#aj_gtmetrix_baseline_yslow").html(a+"%"),jQuery("#aj_gtmetrix_best_yslow").html(r+"%"),jQuery("#aj_gtmetrix_best_fullyloaded").html(i+"s"),jQuery("#aj_gtmetrix_best_url").attr("href",j).html(j),"aj_step2b"==e.id||"aj_step2c"==e.id?(jQuery("#aj_step4_jquery_excluded").hide(),jQuery("#aj_step4_jquery_not_excluded").show()):("aj_step2d"==e.id||"aj_step2e"==e.id)&&(jQuery("#aj_step4_jquery_excluded").show(),jQuery("#aj_step4_jquery_not_excluded").hide()),jQuery(".aj_gtmetrix_credits").html(e.credits),jQuery("#aj_step_results").show()}else console.log(e)}catch(l){console.log(l)}})}else{var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:a,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:t};jQuery.post(aj_localize_admin.ajaxurl,_,function(t){try{if(t=jQuery.parseJSON(t),t.status!==!1){var r=t.results.report_url+"/screenshot.jpg",_=t.results.pagespeed_score,i=t.results.yslow_score,j=parseFloat(t.results.fully_loaded_time/1e3).toFixed(2),l=Math.floor(t.results.page_bytes/1024),o=t.results.page_elements,u=''+t.results.report_url+"",n=u.replace("https://","https://"+a+":"+s+"@"),p=t.name,y=t.url,c=255*(1-_/100),d=255*(1-i/100),m=255*(_/100),Q=255*(i/100),h="rgb("+Math.floor(c)+","+Math.floor(m)+",0 )",g="rgb("+Math.floor(d)+","+Math.floor(Q)+",0 )";"aj_gtmetrix_test"==e&&(e="aj_latest"),jQuery("#"+e+"_please_wait").hide(),jQuery("."+e+"_screenshot").attr("src",r),jQuery("."+e+"_pagespeed").html(_+"%").css({color:h}),jQuery("."+e+"_yslow").html(i+"%").css({color:g}),jQuery("."+e+"_flt").html(j+"s"),jQuery("."+e+"_tps").html(l+"KB"),jQuery("."+e+"_requests").html(o),jQuery("."+e+"_report").html(n),jQuery("#"+e+"_gtmetrix_results").show(),jQuery("."+e+"_gtmetrix").html(p),jQuery("."+e+"_url").attr("href",y).html(y),jQuery(".aj_gtmetrix_credits").html(t.credits),"aj_step2"==e?(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved x'),jQuery("#aj_step2b").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2b").offset().top},1e3),aj_step("aj_step2b")):"aj_step2b"==e?(jQuery("#aj_step2c").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2c").offset().top},1e3),aj_step("aj_step2c")):"aj_step2c"==e?(jQuery("#aj_step2d").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2d").offset().top},1e3),aj_step("aj_step2d")):"aj_step2d"==e?(jQuery("#aj_step2e").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2e").offset().top},1e3),aj_step("aj_step2e")):"aj_step2e"==e?(jQuery("#aj_step_results").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step_results").offset().top},1e3),aj_step("aj_step_results")):"aj_latest"==e&&(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved x'),jQuery("#aj_latest_gtmetrix_results").show(),jQuery("#aj_latest_please_wait").hide(),jQuery("html, body").animate({scrollTop:jQuery("#aj_latest_please_wait").offset().top},1e3))}else console.log(t)}catch(f){console.log(f)}})}}jQuery(document).ready(function(){jQuery(document).on("click",".aj-upgrade-notice .notice-dismiss",function(){var e=jQuery("#aj_nonce").val(),t=jQuery(".aj-upgrade-notice").attr("data-id");jQuery.ajax({url:aj.ajaxurl,data:{action:"async_javascript_dismiss_upgrade",notice_id:t,security:e}})}),jQuery(document).on("click",".aj_steps_button",function(e){e.preventDefault();var t=jQuery("#aj_nonce").val(),a=jQuery(this).attr("data-id");if("aj_goto_settings"==a){var s=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=s}else if("aj_apply_settings"==a||"aj_step2b_apply"==a||"aj_step2c_apply"==a||"aj_step2d_apply"==a||"aj_step2e_apply"==a){if("aj_apply_settings"!=a)var r=a.replace("_apply","");else{var r="";jQuery("#aj_notification").fadeIn("slow").html('Settings Saved x')}var _={action:"aj_steps",sub_action:"aj_apply_settings",settings:r,site_url:aj_localize_admin.siteurl,security:t};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{e=jQuery.parseJSON(e),e.status!==!1?(jQuery("#aj_step5").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step5").offset().top},1e3),""!=r&&jQuery("#aj_notification").fadeIn("slow").html('Settings Saved x')):console.log(e)}catch(t){console.log(t)}})}else if("aj_save_settings"==a){if(jQuery("#aj_enabled").is(":checked"))var i=1;else var i=0;var j=jQuery("input[type=radio][name=aj_method]:checked").val(),l=jQuery("input[type=radio][name=aj_jquery]:checked").val(),o=jQuery("#aj_exclusions").val();if(jQuery("#aj_autoptimize_enabled").is(":visible"))if(jQuery("#aj_autoptimize_enabled").is(":checked"))var u=1,n=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else var u=0,n=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else var u=0,n="async";var _={action:"aj_steps",sub_action:"aj_save_settings",aj_enabled:i,aj_method:j,aj_jquery:l,aj_exclusions:o,aj_autoptimize_enabled:u,aj_autoptimize_method:n,security:t};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{e=jQuery.parseJSON(e),e.status!==!1?jQuery("#aj_notification").fadeIn("slow").html('Settings Saved x'):console.log(e)}catch(t){console.log(t)}})}else{var p=jQuery("#aj_gtmetrix_username").val(),y=jQuery("#aj_gtmetrix_api_key").val(),c=(jQuery("#aj_gtmetrix_server").val(),!1);if(""==p&&(jQuery("#aj_gtmetrix_username").addClass("aj_field_error"),c=!0),""==y&&(jQuery("#aj_gtmetrix_api_key").addClass("aj_field_error"),c=!0),c!==!1)return!1;"aj_gtmetrix_test"!=a?(jQuery(this).hide(),jQuery("#"+a).show()):jQuery("#aj_latest_please_wait").show(),aj_step(a)}}),jQuery(document).on("change","input[type=radio][name=aj_step4_check]",function(){var e=(jQuery("#aj_nonce").val(),jQuery(this).val());"y"==e?(jQuery("#aj_step4_y").show(),jQuery("#aj_step4_n").hide()):(jQuery("#aj_step4_n").show(),jQuery("#aj_step4_y").hide())}),jQuery(document).on("click",".aj_dismiss",function(){jQuery("#aj_nonce").val();jQuery("#aj_notification").fadeOut("slow")})});