mirror of https://github.com/gophish/gophish
Formatting Javascript using js-beautifier
parent
e78ec27ef2
commit
2dda83814c
|
@ -67,11 +67,15 @@ $(document).ready(function(){
|
|||
// Setup tooltips
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
// Setup our graphs
|
||||
var timeline_data = {series:[{
|
||||
var timeline_data = {
|
||||
series: [{
|
||||
name: "Events",
|
||||
data: []
|
||||
}]}
|
||||
var email_data = {series:[]}
|
||||
}]
|
||||
}
|
||||
var email_data = {
|
||||
series: []
|
||||
}
|
||||
var email_legend = {}
|
||||
var email_series_data = {}
|
||||
var timeline_opts = {
|
||||
|
@ -117,10 +121,17 @@ $(document).ready(function(){
|
|||
})
|
||||
// Setup the graphs
|
||||
$.each(campaign.timeline, function(i, event) {
|
||||
timeline_data.series[0].data.push({meta : i, x: new Date(event.time), y:1})
|
||||
timeline_data.series[0].data.push({
|
||||
meta: i,
|
||||
x: new Date(event.time),
|
||||
y: 1
|
||||
})
|
||||
})
|
||||
$.each(email_series_data, function(status, count) {
|
||||
email_data.series.push({meta: status, value: count})
|
||||
email_data.series.push({
|
||||
meta: status,
|
||||
value: count
|
||||
})
|
||||
})
|
||||
var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts)
|
||||
// Setup the overview chart listeners
|
||||
|
@ -201,7 +212,9 @@ $(document).ready(function(){
|
|||
bubbles = []
|
||||
$.each(campaign.results, function(i, result) {
|
||||
// Check that it wasn't an internal IP
|
||||
if (result.latitude == 0 && result.longitude == 0) { return true; }
|
||||
if (result.latitude == 0 && result.longitude == 0) {
|
||||
return true;
|
||||
}
|
||||
newIP = true
|
||||
$.each(bubbles, function(i, bubble) {
|
||||
if (bubble.ip == result.ip) {
|
||||
|
|
|
@ -12,7 +12,9 @@ var labels = {
|
|||
function save() {
|
||||
groups = []
|
||||
$.each($("#groupTable").DataTable().rows().data(), function(i, group) {
|
||||
groups.push({name: group[0]})
|
||||
groups.push({
|
||||
name: group[0]
|
||||
})
|
||||
})
|
||||
console.log(groups)
|
||||
var campaign = {
|
||||
|
@ -61,8 +63,7 @@ function edit(campaign){
|
|||
if (groups.length == 0) {
|
||||
modalError("No groups found!")
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
group_bh.add(groups)
|
||||
}
|
||||
})
|
||||
|
@ -71,8 +72,7 @@ function edit(campaign){
|
|||
if (templates.length == 0) {
|
||||
modalError("No templates found!")
|
||||
return false
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
template_bh.add(templates)
|
||||
}
|
||||
})
|
||||
|
@ -81,8 +81,7 @@ function edit(campaign){
|
|||
if (pages.length == 0) {
|
||||
modalError("No pages found!")
|
||||
return false
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
page_bh.add(pages)
|
||||
}
|
||||
})
|
||||
|
@ -133,7 +132,9 @@ $(document).ready(function(){
|
|||
// Create the group typeahead objects
|
||||
groupTable = $("#groupTable").DataTable()
|
||||
group_bh = new Bloodhound({
|
||||
datumTokenizer: function(g) { return Bloodhound.tokenizers.whitespace(g.name) },
|
||||
datumTokenizer: function(g) {
|
||||
return Bloodhound.tokenizers.whitespace(g.name)
|
||||
},
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
local: []
|
||||
})
|
||||
|
@ -142,13 +143,16 @@ $(document).ready(function(){
|
|||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
},
|
||||
{
|
||||
}, {
|
||||
name: "groups",
|
||||
source: group_bh,
|
||||
templates: {
|
||||
empty: function(data) {return '<div class="tt-suggestion">No groups matched that query</div>' },
|
||||
suggestion: function(data){ return '<div>' + data.name + '</div>' }
|
||||
empty: function(data) {
|
||||
return '<div class="tt-suggestion">No groups matched that query</div>'
|
||||
},
|
||||
suggestion: function(data) {
|
||||
return '<div>' + data.name + '</div>'
|
||||
}
|
||||
}
|
||||
})
|
||||
.bind('typeahead:select', function(ev, group) {
|
||||
|
@ -159,7 +163,9 @@ $(document).ready(function(){
|
|||
});
|
||||
// Create the template typeahead objects
|
||||
template_bh = new Bloodhound({
|
||||
datumTokenizer: function(t) { return Bloodhound.tokenizers.whitespace(t.name) },
|
||||
datumTokenizer: function(t) {
|
||||
return Bloodhound.tokenizers.whitespace(t.name)
|
||||
},
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
local: []
|
||||
})
|
||||
|
@ -168,13 +174,16 @@ $(document).ready(function(){
|
|||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
},
|
||||
{
|
||||
}, {
|
||||
name: "templates",
|
||||
source: template_bh,
|
||||
templates: {
|
||||
empty: function(data) {return '<div class="tt-suggestion">No templates matched that query</div>' },
|
||||
suggestion: function(data){ return '<div>' + data.name + '</div>' }
|
||||
empty: function(data) {
|
||||
return '<div class="tt-suggestion">No templates matched that query</div>'
|
||||
},
|
||||
suggestion: function(data) {
|
||||
return '<div>' + data.name + '</div>'
|
||||
}
|
||||
}
|
||||
})
|
||||
.bind('typeahead:select', function(ev, template) {
|
||||
|
@ -185,7 +194,9 @@ $(document).ready(function(){
|
|||
});
|
||||
// Create the landing page typeahead objects
|
||||
page_bh = new Bloodhound({
|
||||
datumTokenizer: function(p) { return Bloodhound.tokenizers.whitespace(p.name) },
|
||||
datumTokenizer: function(p) {
|
||||
return Bloodhound.tokenizers.whitespace(p.name)
|
||||
},
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
local: []
|
||||
})
|
||||
|
@ -194,13 +205,16 @@ $(document).ready(function(){
|
|||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
},
|
||||
{
|
||||
}, {
|
||||
name: "pages",
|
||||
source: page_bh,
|
||||
templates: {
|
||||
empty: function(data) {return '<div class="tt-suggestion">No pages matched that query</div>' },
|
||||
suggestion: function(data){ return '<div>' + data.name + '</div>' }
|
||||
empty: function(data) {
|
||||
return '<div class="tt-suggestion">No pages matched that query</div>'
|
||||
},
|
||||
suggestion: function(data) {
|
||||
return '<div>' + data.name + '</div>'
|
||||
}
|
||||
}
|
||||
})
|
||||
.bind('typeahead:select', function(ev, page) {
|
||||
|
|
|
@ -17,8 +17,15 @@ $(document).ready(function(){
|
|||
if (campaigns.length > 0) {
|
||||
$("#dashboard").show()
|
||||
// Create the overview chart data
|
||||
var overview_data = {labels:[],series:[[]]}
|
||||
var average_data = {series:[]}
|
||||
var overview_data = {
|
||||
labels: [],
|
||||
series: [
|
||||
[]
|
||||
]
|
||||
}
|
||||
var average_data = {
|
||||
series: []
|
||||
}
|
||||
var overview_opts = {
|
||||
axisX: {
|
||||
showGrid: false
|
||||
|
@ -60,11 +67,20 @@ $(document).ready(function(){
|
|||
average += campaign.y
|
||||
// Add the data to the overview chart
|
||||
overview_data.labels.push(campaign_date)
|
||||
overview_data.series[0].push({meta : i, value: campaign.y})
|
||||
overview_data.series[0].push({
|
||||
meta: i,
|
||||
value: campaign.y
|
||||
})
|
||||
})
|
||||
average = Math.floor(average / campaigns.length);
|
||||
average_data.series.push({meta: "Unsuccessful Phishes", value: 100 - average})
|
||||
average_data.series.push({meta: "Successful Phishes", value: average})
|
||||
average_data.series.push({
|
||||
meta: "Unsuccessful Phishes",
|
||||
value: 100 - average
|
||||
})
|
||||
average_data.series.push({
|
||||
meta: "Successful Phishes",
|
||||
value: average
|
||||
})
|
||||
// Build the charts
|
||||
var average_chart = new Chartist.Pie("#average_chart", average_data, average_opts)
|
||||
var overview_chart = new Chartist.Line('#overview_chart', overview_data, overview_opts)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
Author: Jordan Wright <github.com/jordan-wright>
|
||||
*/
|
||||
var pages = []
|
||||
|
||||
// Save attempts to POST to /templates/
|
||||
function save(idx) {
|
||||
var page = {}
|
||||
|
@ -69,7 +70,9 @@ function importSite(){
|
|||
}
|
||||
|
||||
function edit(idx) {
|
||||
$("#modalSubmit").unbind('click').click(function(){save(idx)})
|
||||
$("#modalSubmit").unbind('click').click(function() {
|
||||
save(idx)
|
||||
})
|
||||
$("#html_editor").ckeditor()
|
||||
var page = {}
|
||||
if (idx != -1) {
|
||||
|
@ -125,13 +128,11 @@ $(document).ready(function(){
|
|||
});
|
||||
$('.modal').on('shown.bs.modal', function(event) {
|
||||
// Keep track of the number of open modals
|
||||
if ( typeof( $('body').data( 'fv_open_modals' ) ) == 'undefined' )
|
||||
{
|
||||
if (typeof($('body').data('fv_open_modals')) == 'undefined') {
|
||||
$('body').data('fv_open_modals', 0);
|
||||
}
|
||||
// if the z-index of this modal has been set, ignore.
|
||||
if ( $(this).hasClass( 'fv-modal-stack' ) )
|
||||
{
|
||||
if ($(this).hasClass('fv-modal-stack')) {
|
||||
return;
|
||||
}
|
||||
$(this).addClass('fv-modal-stack');
|
||||
|
|
|
@ -15,7 +15,9 @@ var icons = {
|
|||
|
||||
// Save attempts to POST to /templates/
|
||||
function save(idx) {
|
||||
var template = {attachments:[]}
|
||||
var template = {
|
||||
attachments: []
|
||||
}
|
||||
template.name = $("#name").val()
|
||||
template.subject = $("#subject").val()
|
||||
template.html = CKEDITOR.instances["html_editor"].getData();
|
||||
|
@ -101,15 +103,18 @@ function attach(files){
|
|||
}
|
||||
|
||||
function edit(idx) {
|
||||
$("#modalSubmit").unbind('click').click(function(){save(idx)})
|
||||
$("#attachmentUpload").unbind('click').click(function(){this.value=null})
|
||||
$("#modalSubmit").unbind('click').click(function() {
|
||||
save(idx)
|
||||
})
|
||||
$("#attachmentUpload").unbind('click').click(function() {
|
||||
this.value = null
|
||||
})
|
||||
$("#html_editor").ckeditor()
|
||||
$("#attachmentsTable").show()
|
||||
attachmentsTable = null
|
||||
if ($.fn.dataTable.isDataTable('#attachmentsTable')) {
|
||||
attachmentsTable = $('#attachmentsTable').DataTable();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
attachmentsTable = $("#attachmentsTable").DataTable({
|
||||
"aoColumnDefs": [{
|
||||
"targets": [3, 4],
|
||||
|
@ -117,7 +122,9 @@ function edit(idx){
|
|||
}]
|
||||
});
|
||||
}
|
||||
var template = {attachments:[]}
|
||||
var template = {
|
||||
attachments: []
|
||||
}
|
||||
if (idx != -1) {
|
||||
template = templates[idx]
|
||||
$("#name").val(template.name)
|
||||
|
@ -211,13 +218,11 @@ $(document).ready(function(){
|
|||
});
|
||||
$('.modal').on('shown.bs.modal', function(event) {
|
||||
// Keep track of the number of open modals
|
||||
if ( typeof( $('body').data( 'fv_open_modals' ) ) == 'undefined' )
|
||||
{
|
||||
if (typeof($('body').data('fv_open_modals')) == 'undefined') {
|
||||
$('body').data('fv_open_modals', 0);
|
||||
}
|
||||
// if the z-index of this modal has been set, ignore.
|
||||
if ( $(this).hasClass( 'fv-modal-stack' ) )
|
||||
{
|
||||
if ($(this).hasClass('fv-modal-stack')) {
|
||||
return;
|
||||
}
|
||||
$(this).addClass('fv-modal-stack');
|
||||
|
|
|
@ -54,7 +54,9 @@ function dismiss(){
|
|||
|
||||
function edit(idx) {
|
||||
targets = $("#targetsTable").dataTable()
|
||||
$("#modalSubmit").unbind('click').click(function(){save(idx)})
|
||||
$("#modalSubmit").unbind('click').click(function() {
|
||||
save(idx)
|
||||
})
|
||||
if (idx == -1) {
|
||||
group = {}
|
||||
} else {
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
function errorFlash(message) {
|
||||
$("#flashes").empty()
|
||||
$("#flashes").append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
|
||||
<i class=\"fa fa-exclamation-circle\"></i> " + message + "</div>"
|
||||
)
|
||||
<i class=\"fa fa-exclamation-circle\"></i> " + message + "</div>")
|
||||
}
|
||||
|
||||
function successFlash(message) {
|
||||
$("#flashes").empty()
|
||||
$("#flashes").append("<div style=\"text-align:center\" class=\"alert alert-success\">\
|
||||
<i class=\"fa fa-check-circle\"></i> " + message + "</div>"
|
||||
)
|
||||
<i class=\"fa fa-check-circle\"></i> " + message + "</div>")
|
||||
}
|
||||
|
||||
function modalError(message) {
|
||||
|
|
Loading…
Reference in New Issue