function fetchLogs(){var e={action:"sn_ss_get_logs",nonce:secninScheduledScanner.nonce};jQuery.post(ajaxurl,e,(function(e){e.success?jQuery("#wf-sn-ss-log tbody").html(e.data):jQuery("#wf-sn-ss-log tbody").html('<tr><td colspan="4"><span class="no-logs">'+e.data+"</span></td></tr>")}))}jQuery(document).ready((function($){fetchLogs(),jQuery("#sn-ss-test").on("click",(function(){if(confirm("Please remember to save settings before testing them. Continue?")){var e={action:"sn_ss_cs_test",nonce:secninScheduledScanner.nonce};jQuery("#wf-ss-output").show();var s=Date.now(),n=jQuery("#wf-ss-output");jQuery.ajax({url:ajaxurl,type:"POST",data:e,success:function(e){clearInterval(a),n.empty(),n.append("<p>Success: "+e.data.message+"</p>")},error:function(){clearInterval(a),n.empty()}});var a=setInterval((function(){var e=Math.floor((Date.now()-s)/1e3);$("#wf-ss-output #sn-timer").text("Time elapsed: "+e+" seconds")}),1e3)}})),$("#wf-sn-ss-truncate-log").on("click",(function(){if(confirm("Are you sure you want to delete all log entries?")){var e={action:"sn_ss_truncate_log",nonce:secninScheduledScanner.nonce};$.post(ajaxurl,e,(function(e){e?fetchLogs():alert("Bad AJAX response. Please reload the page.")}))}return!1})),$(document).on("click",".ss-details-sn",(function(){var e=$(this),s={action:"sn_ss_sn_details",nonce:secninScheduledScanner.nonce,row_id:e.attr("data-row-id")},n=e.attr("data-timestamp");return $(".ss-details-sn").prop("disabled",!0),e.append('<span class="spinner is-active"></span>'),$.post(ajaxurl,s,(function(e){$(".spinner").remove(),$(".ss-details-sn").prop("disabled",!1),e?$("#sn-scheduled-scanner-results").html(e).dialog({title:"Security Ninja results from "+n}).dialog("open"):alert("Bad AJAX response. Please reload the page.")})).fail((function(){alert("An error occurred. Please try again."),$(".spinner").remove(),$(".ss-details-sn").prop("disabled",!1)})),!1})),$(document).on("click",".ss-details-cs",(function(){var e=$(this),s={action:"sn_ss_cs_details",row_id:e.attr("data-row-id"),nonce:secninScheduledScanner.nonce},n=e.attr("data-timestamp");return $(".ss-details-cs").prop("disabled",!0),e.append('<span class="spinner is-active"></span>'),$.post(ajaxurl,s,(function(e){$(".spinner").remove(),$(".ss-details-cs").prop("disabled",!1),e?jQuery("#sn-scheduled-scanner-results").html(e).dialog({title:"Core Scanner results from "+n}).dialog("open"):alert("Bad AJAX response. Please reload the page.")})).fail((function(){alert("An error occurred. Please try again."),$(".spinner").remove(),$(".ss-details-cs").prop("disabled",!1)})),!1})),jQuery("#sn-scheduled-scanner").dialog({dialogClass:"wp-dialog",modal:!0,resizable:!0,zIndex:9999,width:900,height:"550",hide:"fade",show:"fade",autoOpen:!1,closeOnEscape:!0})}));