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