function dismiss(){$("#modal\\.flashes").empty(),$("#modal").modal("hide"),$("#resultsTable").dataTable().DataTable().clear().draw()}function deleteCampaign(){swal({title:"Are you sure?",text:"This will delete the campaign. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete Campaign",confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,b){api.campaignId.delete(campaign.id).success(function(b){a()}).error(function(a){b(a.responseJSON.message)})})}}).then(function(){swal("Campaign Deleted!","This campaign has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.href="/campaigns"})})}function completeCampaign(){swal({title:"Are you sure?",text:"Gophish will stop processing events for this campaign",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Complete Campaign",confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,b){api.campaignId.complete(campaign.id).success(function(b){a()}).error(function(a){b(a.responseJSON.message)})})}}).then(function(){swal("Campaign Completed!","This campaign has been completed!","success"),$("#complete_button")[0].disabled=!0,$("#complete_button").text("Completed!"),doPoll=!1})}function exportAsCSV(a){exportHTML=$("#exportButton").html();var b=null;switch(a){case"results":b=campaign.results;break;case"events":b=campaign.timeline}if(b){$("#exportButton").html('');var c=Papa.unparse(b,{}),d=new Blob([c],{type:"text/csv;charset=utf-8;"});if(navigator.msSaveBlob)navigator.msSaveBlob(d,a+".csv");else{var e=window.URL.createObjectURL(d),f=document.createElement("a");f.href=e,f.setAttribute("download",a+".csv"),document.body.appendChild(f),f.click(),document.body.removeChild(f)}$("#exportButton").html(exportHTML)}}function replay(a){function b(){form.attr({action:url}),form.appendTo("body").submit().remove()}request=campaign.timeline[a],details=JSON.parse(request.details),url=null,form=$("