mirror of https://github.com/gophish/gophish
Update campaign_results.min.js
parent
54781b920b
commit
2541c7190b
|
@ -198,6 +198,8 @@ function completeCampaign() {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Exports campaign results as a CSV file
|
||||
function exportAsCleanCSV(scope) {
|
||||
var csvScope = null;
|
||||
var filename = campaign.name + ' - ' + capitalize(scope) + '.csv';
|
||||
|
@ -289,44 +291,40 @@ function exportAsCleanCSV(scope) {
|
|||
// exportAsCSV('events');
|
||||
// exportAsCSV('cleanresults'); // Add this line to export clean results
|
||||
|
||||
|
||||
// Exports campaign results as a CSV file
|
||||
exportAsCSV(scope) {
|
||||
exportHTML = $("#exportButton").html();
|
||||
var csvScope = null;
|
||||
var filename = campaign.name + " - " + capitalize(scope) + ".csv";
|
||||
|
||||
switch (scope) {
|
||||
case "results":
|
||||
csvScope = campaign.results;
|
||||
break;
|
||||
case "events":
|
||||
csvScope = campaign.timeline;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!csvScope) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("#exportButton").html('<i class="fa fa-spinner fa-spin"></i>');
|
||||
|
||||
var csvString = Papa.unparse(csvScope, { escapeFormulae: true });
|
||||
var csvData = new Blob([csvString], { type: "text/csv;charset=utf-8;" });
|
||||
|
||||
if (navigator.msSaveBlob) {
|
||||
navigator.msSaveBlob(csvData, filename);
|
||||
} else {
|
||||
var csvURL = window.URL.createObjectURL(csvData);
|
||||
var dlLink = document.createElement("a");
|
||||
dlLink.href = csvURL;
|
||||
dlLink.setAttribute("download", filename);
|
||||
document.body.appendChild(dlLink);
|
||||
dlLink.click();
|
||||
document.body.removeChild(dlLink);
|
||||
}
|
||||
|
||||
$("#exportButton").html(exportHTML);
|
||||
function exportAsCSV(scope) {
|
||||
exportHTML = $("#exportButton").html()
|
||||
var csvScope = null
|
||||
var filename = campaign.name + ' - ' + capitalize(scope) + '.csv'
|
||||
switch (scope) {
|
||||
case "results":
|
||||
csvScope = campaign.results
|
||||
break;
|
||||
case "events":
|
||||
csvScope = campaign.timeline
|
||||
break;
|
||||
}
|
||||
if (!csvScope) {
|
||||
return
|
||||
}
|
||||
$("#exportButton").html('<i class="fa fa-spinner fa-spin"></i>')
|
||||
var csvString = Papa.unparse(csvScope, {
|
||||
'escapeFormulae': true
|
||||
})
|
||||
var csvData = new Blob([csvString], {
|
||||
type: 'text/csv;charset=utf-8;'
|
||||
});
|
||||
if (navigator.msSaveBlob) {
|
||||
navigator.msSaveBlob(csvData, filename);
|
||||
} else {
|
||||
var csvURL = window.URL.createObjectURL(csvData);
|
||||
var dlLink = document.createElement('a');
|
||||
dlLink.href = csvURL;
|
||||
dlLink.setAttribute('download', filename)
|
||||
document.body.appendChild(dlLink)
|
||||
dlLink.click();
|
||||
document.body.removeChild(dlLink)
|
||||
}
|
||||
$("#exportButton").html(exportHTML)
|
||||
}
|
||||
|
||||
function replay(event_idx) {
|
||||
|
|
Loading…
Reference in New Issue