Projects STRLCPY gophish Commits fa1d4d74
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■
    static/js/dist/app/landing_pages.min.js
    1  -function save(e){var a={};a.name=$("#name").val(),editor=CKEDITOR.instances.html_editor,a.html=editor.getData(),a.capture_credentials=$("#capture_credentials_checkbox").prop("checked"),a.capture_passwords=$("#capture_passwords_checkbox").prop("checked"),a.redirect_url=$("#redirect_url_input").val(),-1!=e?(a.id=pages[e].id,api.pageId.put(a).success(function(e){successFlash("Page edited successfully!"),load(),dismiss()})):api.pages.post(a).success(function(e){successFlash("Page added successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#modal\\.flashes").empty(),$("#name").val(""),$("#html_editor").val(""),$("#url").val(""),$("#redirect_url_input").val(""),$("#modal").find("input[type='checkbox']").prop("checked",!1),$("#capture_passwords").hide(),$("#redirect_url").hide(),$("#modal").modal("hide")}function deletePage(e){confirm("Delete "+pages[e].name+"?")&&api.pageId.delete(pages[e].id).success(function(e){successFlash(e.message),load()})}function importSite(){url=$("#url").val(),url?api.clone_site({url:url,include_resources:!1}).success(function(e){console.log($("#html_editor")),$("#html_editor").val(e.html),CKEDITOR.instances.html_editor.setMode("wysiwyg"),$("#importSiteModal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)}):modalError("No URL Specified!")}function edit(e){$("#modalSubmit").unbind("click").click(function(){save(e)}),$("#html_editor").ckeditor();var a={};-1!=e&&(a=pages[e],$("#name").val(a.name),$("#html_editor").val(a.html),$("#capture_credentials_checkbox").prop("checked",a.capture_credentials),$("#capture_passwords_checkbox").prop("checked",a.capture_passwords),$("#redirect_url_input").val(a.redirect_url),a.capture_credentials&&($("#capture_passwords").show(),$("#redirect_url").show()))}function copy(e){$("#modalSubmit").unbind("click").click(function(){save(-1)}),$("#html_editor").ckeditor();var a=pages[e];$("#name").val("Copy of "+a.name),$("#html_editor").val(a.html)}function load(){$("#pagesTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.pages.get().success(function(e){pages=e,$("#loading").hide(),pages.length>0?($("#pagesTable").show(),pagesTable=$("#pagesTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),pagesTable.clear(),$.each(pages,function(e,a){pagesTable.row.add([escapeHtml(a.name),moment(a.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Page' onclick='edit("+e+")'> <i class='fa fa-pencil'></i> </button></span>\t\t <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Page' onclick='copy("+e+")'> <i class='fa fa-copy'></i> </button></span> <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Page' onclick='deletePage("+e+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()}),$('[data-toggle="tooltip"]').tooltip()):$("#emptyMessage").show()}).error(function(){$("#loading").hide(),errorFlash("Error fetching pages")})}var pages=[];$(document).ready(function(){$(".modal").on("hidden.bs.modal",function(e){$(this).removeClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")-1)}),$(".modal").on("shown.bs.modal",function(e){void 0===$("body").data("fv_open_modals")&&$("body").data("fv_open_modals",0),$(this).hasClass("fv-modal-stack")||($(this).addClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")+1),$(this).css("z-index",1040+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"))}),$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||$(e.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},$(document).on("hidden.bs.modal",".modal",function(){$(".modal:visible").length&&$(document.body).addClass("modal-open")}),$("#modal").on("hidden.bs.modal",function(e){dismiss()}),$("#capture_credentials_checkbox").change(function(){$("#capture_passwords").toggle(),$("#redirect_url").toggle()}),load()});
     1 +function save(e){var a={};a.name=$("#name").val(),editor=CKEDITOR.instances.html_editor,a.html=editor.getData(),a.capture_credentials=$("#capture_credentials_checkbox").prop("checked"),a.capture_passwords=$("#capture_passwords_checkbox").prop("checked"),a.redirect_url=$("#redirect_url_input").val(),-1!=e?(a.id=pages[e].id,api.pageId.put(a).success(function(e){successFlash("Page edited successfully!"),load(),dismiss()})):api.pages.post(a).success(function(e){successFlash("Page added successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#modal\\.flashes").empty(),$("#name").val(""),$("#html_editor").val(""),$("#url").val(""),$("#redirect_url_input").val(""),$("#modal").find("input[type='checkbox']").prop("checked",!1),$("#capture_passwords").hide(),$("#redirect_url").hide(),$("#modal").modal("hide")}function importSite(){url=$("#url").val(),url?api.clone_site({url:url,include_resources:!1}).success(function(e){console.log($("#html_editor")),$("#html_editor").val(e.html),CKEDITOR.instances.html_editor.setMode("wysiwyg"),$("#importSiteModal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)}):modalError("No URL Specified!")}function edit(e){$("#modalSubmit").unbind("click").click(function(){save(e)}),$("#html_editor").ckeditor();var a={};-1!=e&&(a=pages[e],$("#name").val(a.name),$("#html_editor").val(a.html),$("#capture_credentials_checkbox").prop("checked",a.capture_credentials),$("#capture_passwords_checkbox").prop("checked",a.capture_passwords),$("#redirect_url_input").val(a.redirect_url),a.capture_credentials&&($("#capture_passwords").show(),$("#redirect_url").show()))}function copy(e){$("#modalSubmit").unbind("click").click(function(){save(-1)}),$("#html_editor").ckeditor();var a=pages[e];$("#name").val("Copy of "+a.name),$("#html_editor").val(a.html)}function load(){$("#pagesTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.pages.get().success(function(e){pages=e,$("#loading").hide(),pages.length>0?($("#pagesTable").show(),pagesTable=$("#pagesTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),pagesTable.clear(),$.each(pages,function(e,a){pagesTable.row.add([escapeHtml(a.name),moment(a.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Page' onclick='edit("+e+")'> <i class='fa fa-pencil'></i> </button></span>\t\t <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Page' onclick='copy("+e+")'> <i class='fa fa-copy'></i> </button></span> <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Page' onclick='deletePage("+e+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()}),$('[data-toggle="tooltip"]').tooltip()):$("#emptyMessage").show()}).error(function(){$("#loading").hide(),errorFlash("Error fetching pages")})}var pages=[],deletePage=function(e){swal({title:"Are you sure?",text:"This will delete the landing page. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete "+escapeHtml(pages[e].name),confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,t){api.pageId.delete(pages[e].id).success(function(e){a()}).error(function(e){t(e.responseJSON.message)})})}}).then(function(){swal("Landing Page Deleted!","This landing page has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})};$(document).ready(function(){$(".modal").on("hidden.bs.modal",function(e){$(this).removeClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")-1)}),$(".modal").on("shown.bs.modal",function(e){void 0===$("body").data("fv_open_modals")&&$("body").data("fv_open_modals",0),$(this).hasClass("fv-modal-stack")||($(this).addClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")+1),$(this).css("z-index",1040+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"))}),$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||$(e.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},$(document).on("hidden.bs.modal",".modal",function(){$(".modal:visible").length&&$(document.body).addClass("modal-open")}),$("#modal").on("hidden.bs.modal",function(e){dismiss()}),$("#capture_credentials_checkbox").change(function(){$("#capture_passwords").toggle(),$("#redirect_url").toggle()}),load()});
  • ■ ■ ■ ■
    static/js/dist/app/sending_profiles.min.js
    1  -function sendTestEmail(){var e=[];$.each($("#headersTable").DataTable().rows().data(),function(a,s){e.push({key:unescapeHtml(s[0]),value:unescapeHtml(s[1])})});var a={template:{},first_name:$("input[name=to_first_name]").val(),last_name:$("input[name=to_last_name]").val(),email:$("input[name=to_email]").val(),position:$("input[name=to_position]").val(),url:"",smtp:{from_address:$("#from").val(),host:$("#host").val(),username:$("#username").val(),password:$("#password").val(),ignore_cert_errors:$("#ignore_cert_errors").prop("checked"),headers:e}};btnHtml=$("#sendTestModalSubmit").html(),$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending'),api.send_test_email(a).success(function(e){$("#sendTestEmailModal\\.flashes").empty().append('<div style="text-align:center" class="alert alert-success">\t <i class="fa fa-check-circle"></i> Email Sent!</div>'),$("#sendTestModalSubmit").html(btnHtml)}).error(function(e){$("#sendTestEmailModal\\.flashes").empty().append('<div style="text-align:center" class="alert alert-danger">\t <i class="fa fa-exclamation-circle"></i> '+e.responseJSON.message+"</div>"),$("#sendTestModalSubmit").html(btnHtml)})}function save(e){var a={headers:[]};$.each($("#headersTable").DataTable().rows().data(),function(e,s){a.headers.push({key:unescapeHtml(s[0]),value:unescapeHtml(s[1])})}),a.name=$("#name").val(),a.interface_type=$("#interface_type").val(),a.from_address=$("#from").val(),a.host=$("#host").val(),a.username=$("#username").val(),a.password=$("#password").val(),a.ignore_cert_errors=$("#ignore_cert_errors").prop("checked"),-1!=e?(a.id=profiles[e].id,api.SMTPId.put(a).success(function(e){successFlash("Profile edited successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})):api.SMTP.post(a).success(function(e){successFlash("Profile added successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#modal\\.flashes").empty(),$("#name").val(""),$("#interface_type").val("SMTP"),$("#from").val(""),$("#host").val(""),$("#username").val(""),$("#password").val(""),$("#ignore_cert_errors").prop("checked",!0),$("#headersTable").dataTable().DataTable().clear().draw(),$("#modal").modal("hide")}function deleteProfile(e){confirm("Delete "+profiles[e].name+"?")&&api.SMTPId.delete(profiles[e].id).success(function(e){successFlash(e.message),load()})}function edit(e){headers=$("#headersTable").dataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),$("#modalSubmit").unbind("click").click(function(){save(e)});var a={};-1!=e&&(a=profiles[e],$("#name").val(a.name),$("#interface_type").val(a.interface_type),$("#from").val(a.from_address),$("#host").val(a.host),$("#username").val(a.username),$("#password").val(a.password),$("#ignore_cert_errors").prop("checked",a.ignore_cert_errors),$.each(a.headers,function(e,a){addCustomHeader(a.key,a.value)}))}function copy(e){$("#modalSubmit").unbind("click").click(function(){save(-1)});var a={};a=profiles[e],$("#name").val("Copy of "+a.name),$("#interface_type").val(a.interface_type),$("#from").val(a.from_address),$("#host").val(a.host),$("#username").val(a.username),$("#password").val(a.password),$("#ignore_cert_errors").prop("checked",a.ignore_cert_errors)}function load(){$("#profileTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.SMTP.get().success(function(e){profiles=e,$("#loading").hide(),profiles.length>0?($("#profileTable").show(),profileTable=$("#profileTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),profileTable.clear(),$.each(profiles,function(e,a){profileTable.row.add([escapeHtml(a.name),a.interface_type,moment(a.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Profile' onclick='edit("+e+")'> <i class='fa fa-pencil'></i> </button></span>\t\t <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Profile' onclick='copy("+e+")'> <i class='fa fa-copy'></i> </button></span> <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Profile' onclick='deleteProfile("+e+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()}),$('[data-toggle="tooltip"]').tooltip()):$("#emptyMessage").show()}).error(function(){$("#loading").hide(),errorFlash("Error fetching profiles")})}function addCustomHeader(e,a){var s=[escapeHtml(e),escapeHtml(a),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'],o=headers.DataTable(),t=o.column(0).data().indexOf(escapeHtml(e));t>=0?o.row(t,{order:"index"}).data(s):o.row.add(s),o.draw()}var profiles=[],dismissSendTestEmailModal=function(){$("#sendTestEmailModal\\.flashes").empty(),$("#sendTestModalSubmit").html("<i class='fa fa-envelope'></i> Send")};$(document).ready(function(){$(".modal").on("hidden.bs.modal",function(e){$(this).removeClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")-1)}),$(".modal").on("shown.bs.modal",function(e){void 0===$("body").data("fv_open_modals")&&$("body").data("fv_open_modals",0),$(this).hasClass("fv-modal-stack")||($(this).addClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")+1),$(this).css("z-index",1040+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"))}),$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||$(e.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},$(document).on("hidden.bs.modal",".modal",function(){$(".modal:visible").length&&$(document.body).addClass("modal-open")}),$("#modal").on("hidden.bs.modal",function(e){dismiss()}),$("#sendTestEmailModal").on("hidden.bs.modal",function(e){dismissSendTestEmailModal()}),$("#headersForm").on("submit",function(){return headerKey=$("#headerKey").val(),headerValue=$("#headerValue").val(),""!=headerKey&&""!=headerValue&&(addCustomHeader(headerKey,headerValue),$("#headersForm>div>input").val(""),$("#headerKey").focus(),!1)}),$("#headersTable").on("click","span>i.fa-trash-o",function(){headers.DataTable().row($(this).parents("tr")).remove().draw()}),load()});
     1 +function sendTestEmail(){var e=[];$.each($("#headersTable").DataTable().rows().data(),function(a,t){e.push({key:unescapeHtml(t[0]),value:unescapeHtml(t[1])})});var a={template:{},first_name:$("input[name=to_first_name]").val(),last_name:$("input[name=to_last_name]").val(),email:$("input[name=to_email]").val(),position:$("input[name=to_position]").val(),url:"",smtp:{from_address:$("#from").val(),host:$("#host").val(),username:$("#username").val(),password:$("#password").val(),ignore_cert_errors:$("#ignore_cert_errors").prop("checked"),headers:e}};btnHtml=$("#sendTestModalSubmit").html(),$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending'),api.send_test_email(a).success(function(e){$("#sendTestEmailModal\\.flashes").empty().append('<div style="text-align:center" class="alert alert-success">\t <i class="fa fa-check-circle"></i> Email Sent!</div>'),$("#sendTestModalSubmit").html(btnHtml)}).error(function(e){$("#sendTestEmailModal\\.flashes").empty().append('<div style="text-align:center" class="alert alert-danger">\t <i class="fa fa-exclamation-circle"></i> '+e.responseJSON.message+"</div>"),$("#sendTestModalSubmit").html(btnHtml)})}function save(e){var a={headers:[]};$.each($("#headersTable").DataTable().rows().data(),function(e,t){a.headers.push({key:unescapeHtml(t[0]),value:unescapeHtml(t[1])})}),a.name=$("#name").val(),a.interface_type=$("#interface_type").val(),a.from_address=$("#from").val(),a.host=$("#host").val(),a.username=$("#username").val(),a.password=$("#password").val(),a.ignore_cert_errors=$("#ignore_cert_errors").prop("checked"),-1!=e?(a.id=profiles[e].id,api.SMTPId.put(a).success(function(e){successFlash("Profile edited successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})):api.SMTP.post(a).success(function(e){successFlash("Profile added successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#modal\\.flashes").empty(),$("#name").val(""),$("#interface_type").val("SMTP"),$("#from").val(""),$("#host").val(""),$("#username").val(""),$("#password").val(""),$("#ignore_cert_errors").prop("checked",!0),$("#headersTable").dataTable().DataTable().clear().draw(),$("#modal").modal("hide")}function edit(e){headers=$("#headersTable").dataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),$("#modalSubmit").unbind("click").click(function(){save(e)});var a={};-1!=e&&(a=profiles[e],$("#name").val(a.name),$("#interface_type").val(a.interface_type),$("#from").val(a.from_address),$("#host").val(a.host),$("#username").val(a.username),$("#password").val(a.password),$("#ignore_cert_errors").prop("checked",a.ignore_cert_errors),$.each(a.headers,function(e,a){addCustomHeader(a.key,a.value)}))}function copy(e){$("#modalSubmit").unbind("click").click(function(){save(-1)});var a={};a=profiles[e],$("#name").val("Copy of "+a.name),$("#interface_type").val(a.interface_type),$("#from").val(a.from_address),$("#host").val(a.host),$("#username").val(a.username),$("#password").val(a.password),$("#ignore_cert_errors").prop("checked",a.ignore_cert_errors)}function load(){$("#profileTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.SMTP.get().success(function(e){profiles=e,$("#loading").hide(),profiles.length>0?($("#profileTable").show(),profileTable=$("#profileTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),profileTable.clear(),$.each(profiles,function(e,a){profileTable.row.add([escapeHtml(a.name),a.interface_type,moment(a.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Profile' onclick='edit("+e+")'> <i class='fa fa-pencil'></i> </button></span>\t\t <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Profile' onclick='copy("+e+")'> <i class='fa fa-copy'></i> </button></span> <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Profile' onclick='deleteProfile("+e+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()}),$('[data-toggle="tooltip"]').tooltip()):$("#emptyMessage").show()}).error(function(){$("#loading").hide(),errorFlash("Error fetching profiles")})}function addCustomHeader(e,a){var t=[escapeHtml(e),escapeHtml(a),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'],s=headers.DataTable(),o=s.column(0).data().indexOf(escapeHtml(e));o>=0?s.row(o,{order:"index"}).data(t):s.row.add(t),s.draw()}var profiles=[],dismissSendTestEmailModal=function(){$("#sendTestEmailModal\\.flashes").empty(),$("#sendTestModalSubmit").html("<i class='fa fa-envelope'></i> Send")},deleteProfile=function(e){swal({title:"Are you sure?",text:"This will delete the sending profile. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete "+escapeHtml(profiles[e].name),confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,t){api.SMTPId.delete(profiles[e].id).success(function(e){a()}).error(function(e){t(e.responseJSON.message)})})}}).then(function(){swal("Sending Profile Deleted!","This sending profile has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})};$(document).ready(function(){$(".modal").on("hidden.bs.modal",function(e){$(this).removeClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")-1)}),$(".modal").on("shown.bs.modal",function(e){void 0===$("body").data("fv_open_modals")&&$("body").data("fv_open_modals",0),$(this).hasClass("fv-modal-stack")||($(this).addClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")+1),$(this).css("z-index",1040+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"))}),$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||$(e.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},$(document).on("hidden.bs.modal",".modal",function(){$(".modal:visible").length&&$(document.body).addClass("modal-open")}),$("#modal").on("hidden.bs.modal",function(e){dismiss()}),$("#sendTestEmailModal").on("hidden.bs.modal",function(e){dismissSendTestEmailModal()}),$("#headersForm").on("submit",function(){return headerKey=$("#headerKey").val(),headerValue=$("#headerValue").val(),""!=headerKey&&""!=headerValue&&(addCustomHeader(headerKey,headerValue),$("#headersForm>div>input").val(""),$("#headerKey").focus(),!1)}),$("#headersTable").on("click","span>i.fa-trash-o",function(){headers.DataTable().row($(this).parents("tr")).remove().draw()}),load()});
  • ■ ■ ■ ■
    static/js/dist/app/templates.min.js
    1  -function save(a){var t={attachments:[]};t.name=$("#name").val(),t.subject=$("#subject").val(),t.html=CKEDITOR.instances.html_editor.getData(),t.html=t.html.replace(/https?:\/\/{{\.URL}}/gi,"{{.URL}}"),$("#use_tracker_checkbox").prop("checked")?-1==t.html.indexOf("{{.Tracker}}")&&-1==t.html.indexOf("{{.TrackingUrl}}")&&(t.html=t.html.replace("</body>","{{.Tracker}}</body>")):t.html=t.html.replace("{{.Tracker}}</body>","</body>"),t.text=$("#text_editor").val(),$.each($("#attachmentsTable").DataTable().rows().data(),function(a,e){t.attachments.push({name:unescapeHtml(e[1]),content:e[3],type:e[4]})}),-1!=a?(t.id=templates[a].id,api.templateId.put(t).success(function(a){successFlash("Template edited successfully!"),load(),dismiss()}).error(function(a){modalError(a.responseJSON.message)})):api.templates.post(t).success(function(a){successFlash("Template added successfully!"),load(),dismiss()}).error(function(a){modalError(a.responseJSON.message)})}function dismiss(){$("#modal\\.flashes").empty(),$("#attachmentsTable").dataTable().DataTable().clear().draw(),$("#name").val(""),$("#subject").val(""),$("#text_editor").val(""),$("#html_editor").val(""),$("#modal").modal("hide")}function deleteTemplate(a){confirm("Delete "+templates[a].name+"?")&&api.templateId.delete(templates[a].id).success(function(a){successFlash(a.message),load()})}function attach(a){attachmentsTable=$("#attachmentsTable").DataTable({destroy:!0,order:[[1,"asc"]],columnDefs:[{orderable:!1,targets:"no-sort"},{sClass:"datatable_hidden",targets:[3,4]}]}),$.each(a,function(a,t){var e=new FileReader;e.onload=function(a){var o=icons[t.type]||"fa-file-o";attachmentsTable.row.add(['<i class="fa '+o+'"></i>',escapeHtml(t.name),'<span class="remove-row"><i class="fa fa-trash-o"></i></span>',e.result.split(",")[1],t.type||"application/octet-stream"]).draw()},e.onerror=function(a){console.log(a)},e.readAsDataURL(t)})}function edit(a){$("#modalSubmit").unbind("click").click(function(){save(a)}),$("#attachmentUpload").unbind("click").click(function(){this.value=null}),$("#html_editor").ckeditor(),$("#attachmentsTable").show(),attachmentsTable=$("#attachmentsTable").DataTable({destroy:!0,order:[[1,"asc"]],columnDefs:[{orderable:!1,targets:"no-sort"},{sClass:"datatable_hidden",targets:[3,4]}]});var t={attachments:[]};-1!=a&&(t=templates[a],$("#name").val(t.name),$("#subject").val(t.subject),$("#html_editor").val(t.html),$("#text_editor").val(t.text),$.each(t.attachments,function(a,t){var e=icons[t.type]||"fa-file-o";attachmentsTable.row.add(['<i class="fa '+e+'"></i>',escapeHtml(t.name),'<span class="remove-row"><i class="fa fa-trash-o"></i></span>',t.content,t.type||"application/octet-stream"]).draw()}),-1!=t.html.indexOf("{{.Tracker}}")?$("#use_tracker_checkbox").prop("checked",!0):$("#use_tracker_checkbox").prop("checked",!1)),$("#attachmentsTable").unbind("click").on("click","span>i.fa-trash-o",function(){attachmentsTable.row($(this).parents("tr")).remove().draw()})}function copy(a){$("#modalSubmit").unbind("click").click(function(){save(-1)}),$("#attachmentUpload").unbind("click").click(function(){this.value=null}),$("#html_editor").ckeditor(),$("#attachmentsTable").show(),attachmentsTable=$("#attachmentsTable").DataTable({destroy:!0,order:[[1,"asc"]],columnDefs:[{orderable:!1,targets:"no-sort"},{sClass:"datatable_hidden",targets:[3,4]}]});var t={attachments:[]};t=templates[a],$("#name").val("Copy of "+t.name),$("#subject").val(t.subject),$("#html_editor").val(t.html),$("#text_editor").val(t.text),$.each(t.attachments,function(a,t){var e=icons[t.type]||"fa-file-o";attachmentsTable.row.add(['<i class="fa '+e+'"></i>',escapeHtml(t.name),'<span class="remove-row"><i class="fa fa-trash-o"></i></span>',t.content,t.type||"application/octet-stream"]).draw()}),$("#attachmentsTable").unbind("click").on("click","span>i.fa-trash-o",function(){attachmentsTable.row($(this).parents("tr")).remove().draw()}),-1!=t.html.indexOf("{{.Tracker}}")?$("#use_tracker_checkbox").prop("checked",!0):$("#use_tracker_checkbox").prop("checked",!1)}function importEmail(){raw=$("#email_content").val(),convert_links=$("#convert_links_checkbox").prop("checked"),raw?api.import_email({content:raw,convert_links:convert_links}).success(function(a){$("#text_editor").val(a.text),$("#html_editor").val(a.html),$("#subject").val(a.subject),a.html&&(CKEDITOR.instances.html_editor.setMode("wysiwyg"),$('.nav-tabs a[href="#html"]').click()),$("#importEmailModal").modal("hide")}).error(function(a){modalError(a.responseJSON.message)}):modalError("No Content Specified!")}function load(){$("#templateTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.templates.get().success(function(a){templates=a,$("#loading").hide(),templates.length>0?($("#templateTable").show(),templateTable=$("#templateTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),templateTable.clear(),$.each(templates,function(a,t){templateTable.row.add([escapeHtml(t.name),moment(t.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Template' onclick='edit("+a+")'> <i class='fa fa-pencil'></i> </button></span>\t\t <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Template' onclick='copy("+a+")'> <i class='fa fa-copy'></i> </button></span> <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Template' onclick='deleteTemplate("+a+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()}),$('[data-toggle="tooltip"]').tooltip()):$("#emptyMessage").show()}).error(function(){$("#loading").hide(),errorFlash("Error fetching templates")})}var templates=[],icons={"application/vnd.ms-excel":"fa-file-excel-o","text/plain":"fa-file-text-o","image/gif":"fa-file-image-o","image/png":"fa-file-image-o","application/pdf":"fa-file-pdf-o","application/x-zip-compressed":"fa-file-archive-o","application/x-gzip":"fa-file-archive-o","application/vnd.openxmlformats-officedocument.presentationml.presentation":"fa-file-powerpoint-o","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"fa-file-word-o","application/octet-stream":"fa-file-o","application/x-msdownload":"fa-file-o"};$(document).ready(function(){$(".modal").on("hidden.bs.modal",function(a){$(this).removeClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")-1)}),$(".modal").on("shown.bs.modal",function(a){void 0===$("body").data("fv_open_modals")&&$("body").data("fv_open_modals",0),$(this).hasClass("fv-modal-stack")||($(this).addClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")+1),$(this).css("z-index",1040+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"))}),$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||$(a.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},$(document).on("hidden.bs.modal",".modal",function(){$(".modal:visible").length&&$(document.body).addClass("modal-open")}),$("#modal").on("hidden.bs.modal",function(a){dismiss()}),$("#importEmailModal").on("hidden.bs.modal",function(a){$("#email_content").val("")}),load()});
     1 +function save(e){var t={attachments:[]};t.name=$("#name").val(),t.subject=$("#subject").val(),t.html=CKEDITOR.instances.html_editor.getData(),t.html=t.html.replace(/https?:\/\/{{\.URL}}/gi,"{{.URL}}"),$("#use_tracker_checkbox").prop("checked")?-1==t.html.indexOf("{{.Tracker}}")&&-1==t.html.indexOf("{{.TrackingUrl}}")&&(t.html=t.html.replace("</body>","{{.Tracker}}</body>")):t.html=t.html.replace("{{.Tracker}}</body>","</body>"),t.text=$("#text_editor").val(),$.each($("#attachmentsTable").DataTable().rows().data(),function(e,a){t.attachments.push({name:unescapeHtml(a[1]),content:a[3],type:a[4]})}),-1!=e?(t.id=templates[e].id,api.templateId.put(t).success(function(e){successFlash("Template edited successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})):api.templates.post(t).success(function(e){successFlash("Template added successfully!"),load(),dismiss()}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#modal\\.flashes").empty(),$("#attachmentsTable").dataTable().DataTable().clear().draw(),$("#name").val(""),$("#subject").val(""),$("#text_editor").val(""),$("#html_editor").val(""),$("#modal").modal("hide")}function deleteTemplate(e){confirm("Delete "+templates[e].name+"?")&&api.templateId.delete(templates[e].id).success(function(e){successFlash(e.message),load()})}function attach(e){attachmentsTable=$("#attachmentsTable").DataTable({destroy:!0,order:[[1,"asc"]],columnDefs:[{orderable:!1,targets:"no-sort"},{sClass:"datatable_hidden",targets:[3,4]}]}),$.each(e,function(e,t){var a=new FileReader;a.onload=function(e){var o=icons[t.type]||"fa-file-o";attachmentsTable.row.add(['<i class="fa '+o+'"></i>',escapeHtml(t.name),'<span class="remove-row"><i class="fa fa-trash-o"></i></span>',a.result.split(",")[1],t.type||"application/octet-stream"]).draw()},a.onerror=function(e){console.log(e)},a.readAsDataURL(t)})}function edit(e){$("#modalSubmit").unbind("click").click(function(){save(e)}),$("#attachmentUpload").unbind("click").click(function(){this.value=null}),$("#html_editor").ckeditor(),$("#attachmentsTable").show(),attachmentsTable=$("#attachmentsTable").DataTable({destroy:!0,order:[[1,"asc"]],columnDefs:[{orderable:!1,targets:"no-sort"},{sClass:"datatable_hidden",targets:[3,4]}]});var t={attachments:[]};-1!=e&&(t=templates[e],$("#name").val(t.name),$("#subject").val(t.subject),$("#html_editor").val(t.html),$("#text_editor").val(t.text),$.each(t.attachments,function(e,t){var a=icons[t.type]||"fa-file-o";attachmentsTable.row.add(['<i class="fa '+a+'"></i>',escapeHtml(t.name),'<span class="remove-row"><i class="fa fa-trash-o"></i></span>',t.content,t.type||"application/octet-stream"]).draw()}),-1!=t.html.indexOf("{{.Tracker}}")?$("#use_tracker_checkbox").prop("checked",!0):$("#use_tracker_checkbox").prop("checked",!1)),$("#attachmentsTable").unbind("click").on("click","span>i.fa-trash-o",function(){attachmentsTable.row($(this).parents("tr")).remove().draw()})}function copy(e){$("#modalSubmit").unbind("click").click(function(){save(-1)}),$("#attachmentUpload").unbind("click").click(function(){this.value=null}),$("#html_editor").ckeditor(),$("#attachmentsTable").show(),attachmentsTable=$("#attachmentsTable").DataTable({destroy:!0,order:[[1,"asc"]],columnDefs:[{orderable:!1,targets:"no-sort"},{sClass:"datatable_hidden",targets:[3,4]}]});var t={attachments:[]};t=templates[e],$("#name").val("Copy of "+t.name),$("#subject").val(t.subject),$("#html_editor").val(t.html),$("#text_editor").val(t.text),$.each(t.attachments,function(e,t){var a=icons[t.type]||"fa-file-o";attachmentsTable.row.add(['<i class="fa '+a+'"></i>',escapeHtml(t.name),'<span class="remove-row"><i class="fa fa-trash-o"></i></span>',t.content,t.type||"application/octet-stream"]).draw()}),$("#attachmentsTable").unbind("click").on("click","span>i.fa-trash-o",function(){attachmentsTable.row($(this).parents("tr")).remove().draw()}),-1!=t.html.indexOf("{{.Tracker}}")?$("#use_tracker_checkbox").prop("checked",!0):$("#use_tracker_checkbox").prop("checked",!1)}function importEmail(){raw=$("#email_content").val(),convert_links=$("#convert_links_checkbox").prop("checked"),raw?api.import_email({content:raw,convert_links:convert_links}).success(function(e){$("#text_editor").val(e.text),$("#html_editor").val(e.html),$("#subject").val(e.subject),e.html&&(CKEDITOR.instances.html_editor.setMode("wysiwyg"),$('.nav-tabs a[href="#html"]').click()),$("#importEmailModal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)}):modalError("No Content Specified!")}function load(){$("#templateTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.templates.get().success(function(e){templates=e,$("#loading").hide(),templates.length>0?($("#templateTable").show(),templateTable=$("#templateTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),templateTable.clear(),$.each(templates,function(e,t){templateTable.row.add([escapeHtml(t.name),moment(t.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Template' onclick='edit("+e+")'> <i class='fa fa-pencil'></i> </button></span>\t\t <span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Template' onclick='copy("+e+")'> <i class='fa fa-copy'></i> </button></span> <button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Template' onclick='deleteTemplate("+e+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()}),$('[data-toggle="tooltip"]').tooltip()):$("#emptyMessage").show()}).error(function(){$("#loading").hide(),errorFlash("Error fetching templates")})}var templates=[],icons={"application/vnd.ms-excel":"fa-file-excel-o","text/plain":"fa-file-text-o","image/gif":"fa-file-image-o","image/png":"fa-file-image-o","application/pdf":"fa-file-pdf-o","application/x-zip-compressed":"fa-file-archive-o","application/x-gzip":"fa-file-archive-o","application/vnd.openxmlformats-officedocument.presentationml.presentation":"fa-file-powerpoint-o","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"fa-file-word-o","application/octet-stream":"fa-file-o","application/x-msdownload":"fa-file-o"},deleteTemplate=function(e){swal({title:"Are you sure?",text:"This will delete the template. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete "+escapeHtml(templates[e].name),confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(t,a){api.templateId.delete(templates[e].id).success(function(e){t()}).error(function(e){a(e.responseJSON.message)})})}}).then(function(){swal("Template Deleted!","This template has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})};$(document).ready(function(){$(".modal").on("hidden.bs.modal",function(e){$(this).removeClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")-1)}),$(".modal").on("shown.bs.modal",function(e){void 0===$("body").data("fv_open_modals")&&$("body").data("fv_open_modals",0),$(this).hasClass("fv-modal-stack")||($(this).addClass("fv-modal-stack"),$("body").data("fv_open_modals",$("body").data("fv_open_modals")+1),$(this).css("z-index",1040+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("fv_open_modals")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"))}),$.fn.modal.Constructor.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||$(e.target).closest(".cke_dialog, .cke").length||this.$element.trigger("focus")},this))},$(document).on("hidden.bs.modal",".modal",function(){$(".modal:visible").length&&$(document.body).addClass("modal-open")}),$("#modal").on("hidden.bs.modal",function(e){dismiss()}),$("#importEmailModal").on("hidden.bs.modal",function(e){$("#email_content").val("")}),load()});
  • ■ ■ ■ ■
    static/js/dist/app/users.min.js
    1  -function save(a){var e=[];$.each($("#targetsTable").DataTable().rows().data(),function(a,t){e.push({first_name:unescapeHtml(t[0]),last_name:unescapeHtml(t[1]),email:unescapeHtml(t[2]),position:unescapeHtml(t[3])})});var t={name:$("#name").val(),targets:e};-1!=a?(t.id=a,api.groupId.put(t).success(function(a){successFlash("Group updated successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(a){modalError(a.responseJSON.message)})):api.groups.post(t).success(function(a){successFlash("Group added successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(a){modalError(a.responseJSON.message)})}function dismiss(){$("#targetsTable").dataTable().DataTable().clear().draw(),$("#name").val(""),$("#modal\\.flashes").empty()}function edit(a){if(targets=$("#targetsTable").dataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),$("#modalSubmit").unbind("click").click(function(){save(a)}),-1==a);else api.groupId.get(a).success(function(a){$("#name").val(a.name),$.each(a.targets,function(a,e){targets.DataTable().row.add([escapeHtml(e.first_name),escapeHtml(e.last_name),escapeHtml(e.email),escapeHtml(e.position),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>']).draw()})}).error(function(){errorFlash("Error fetching group")});$("#csvupload").fileupload({url:"/api/import/group?api_key="+user.api_key,dataType:"json",add:function(a,e){$("#modal\\.flashes").empty();var t=/(csv|txt)$/i,s=e.originalFiles[0].name;if(s&&!t.test(s.split(".").pop()))return modalError("Unsupported file extension (use .csv or .txt)"),!1;e.submit()},done:function(a,e){$.each(e.result,function(a,e){addTarget(e.first_name,e.last_name,e.email,e.position)}),targets.DataTable().draw()}})}function deleteGroup(a){var e=groups.find(function(e){return e.id===a});if(!e)return void console.log("wat");confirm("Delete "+e.name+"?")&&api.groupId.delete(a).success(function(a){successFlash(a.message),load()})}function addTarget(a,e,t,s){var o=escapeHtml(t).toLowerCase(),r=[escapeHtml(a),escapeHtml(e),o,escapeHtml(s),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'],n=targets.DataTable(),i=n.column(2,{order:"index"}).data().indexOf(o);i>=0?n.row(i,{order:"index"}).data(r):n.row.add(r)}function load(){$("#groupTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.groups.summary().success(function(a){if($("#loading").hide(),a.total>0){groups=a.groups,$("#emptyMessage").hide(),$("#groupTable").show();var e=$("#groupTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]});e.clear(),$.each(groups,function(a,t){e.row.add([escapeHtml(t.name),escapeHtml(t.num_targets),moment(t.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-target='#modal' onclick='edit("+t.id+")'> <i class='fa fa-pencil'></i> </button> <button class='btn btn-danger' onclick='deleteGroup("+t.id+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()})}else $("#emptyMessage").show()}).error(function(){errorFlash("Error fetching groups")})}var groups=[],downloadCSVTemplate=function(){var a=[{"First Name":"Example","Last Name":"User",Email:"[email protected]",Position:"Systems Administrator"}],e=Papa.unparse(a,{}),t=new Blob([e],{type:"text/csv;charset=utf-8;"});if(navigator.msSaveBlob)navigator.msSaveBlob(t,"group_template.csv");else{var s=window.URL.createObjectURL(t),o=document.createElement("a");o.href=s,o.setAttribute("download","group_template.csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o)}};$(document).ready(function(){load(),$("#targetForm").submit(function(){return addTarget($("#firstName").val(),$("#lastName").val(),$("#email").val(),$("#position").val()),targets.DataTable().draw(),$("#targetForm>div>input").val(""),$("#firstName").focus(),!1}),$("#targetsTable").on("click","span>i.fa-trash-o",function(){targets.DataTable().row($(this).parents("tr")).remove().draw()}),$("#modal").on("hide.bs.modal",function(){dismiss()}),$("#csv-template").click(downloadCSVTemplate)});
     1 +function save(e){var a=[];$.each($("#targetsTable").DataTable().rows().data(),function(e,t){a.push({first_name:unescapeHtml(t[0]),last_name:unescapeHtml(t[1]),email:unescapeHtml(t[2]),position:unescapeHtml(t[3])})});var t={name:$("#name").val(),targets:a};-1!=e?(t.id=e,api.groupId.put(t).success(function(e){successFlash("Group updated successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})):api.groups.post(t).success(function(e){successFlash("Group added successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#targetsTable").dataTable().DataTable().clear().draw(),$("#name").val(""),$("#modal\\.flashes").empty()}function edit(e){if(targets=$("#targetsTable").dataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),$("#modalSubmit").unbind("click").click(function(){save(e)}),-1==e);else api.groupId.get(e).success(function(e){$("#name").val(e.name),$.each(e.targets,function(e,a){targets.DataTable().row.add([escapeHtml(a.first_name),escapeHtml(a.last_name),escapeHtml(a.email),escapeHtml(a.position),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>']).draw()})}).error(function(){errorFlash("Error fetching group")});$("#csvupload").fileupload({url:"/api/import/group?api_key="+user.api_key,dataType:"json",add:function(e,a){$("#modal\\.flashes").empty();var t=/(csv|txt)$/i,s=a.originalFiles[0].name;if(s&&!t.test(s.split(".").pop()))return modalError("Unsupported file extension (use .csv or .txt)"),!1;a.submit()},done:function(e,a){$.each(a.result,function(e,a){addTarget(a.first_name,a.last_name,a.email,a.position)}),targets.DataTable().draw()}})}function addTarget(e,a,t,s){var o=escapeHtml(t).toLowerCase(),r=[escapeHtml(e),escapeHtml(a),o,escapeHtml(s),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'],n=targets.DataTable(),i=n.column(2,{order:"index"}).data().indexOf(o);i>=0?n.row(i,{order:"index"}).data(r):n.row.add(r)}function load(){$("#groupTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.groups.summary().success(function(e){if($("#loading").hide(),e.total>0){groups=e.groups,$("#emptyMessage").hide(),$("#groupTable").show();var a=$("#groupTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]});a.clear(),$.each(groups,function(e,t){a.row.add([escapeHtml(t.name),escapeHtml(t.num_targets),moment(t.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-target='#modal' onclick='edit("+t.id+")'> <i class='fa fa-pencil'></i> </button> <button class='btn btn-danger' onclick='deleteGroup("+t.id+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()})}else $("#emptyMessage").show()}).error(function(){errorFlash("Error fetching groups")})}var groups=[],downloadCSVTemplate=function(){var e=[{"First Name":"Example","Last Name":"User",Email:"[email protected]",Position:"Systems Administrator"}],a=Papa.unparse(e,{}),t=new Blob([a],{type:"text/csv;charset=utf-8;"});if(navigator.msSaveBlob)navigator.msSaveBlob(t,"group_template.csv");else{var s=window.URL.createObjectURL(t),o=document.createElement("a");o.href=s,o.setAttribute("download","group_template.csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o)}},deleteGroup=function(e){var a=groups.find(function(a){return a.id===e});a&&swal({title:"Are you sure?",text:"This will delete the group. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete "+escapeHtml(a.name),confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,t){api.groupId.delete(e).success(function(e){a()}).error(function(e){t(e.responseJSON.message)})})}}).then(function(){swal("Group Deleted!","This group has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})};$(document).ready(function(){load(),$("#targetForm").submit(function(){return addTarget($("#firstName").val(),$("#lastName").val(),$("#email").val(),$("#position").val()),targets.DataTable().draw(),$("#targetForm>div>input").val(""),$("#firstName").focus(),!1}),$("#targetsTable").on("click","span>i.fa-trash-o",function(){targets.DataTable().row($(this).parents("tr")).remove().draw()}),$("#modal").on("hide.bs.modal",function(){dismiss()}),$("#csv-template").click(downloadCSVTemplate)});
  • ■ ■ ■ ■ ■
    static/js/src/app/landing_pages.js
    skipped 47 lines
    48 48   $("#modal").modal('hide')
    49 49  }
    50 50   
    51  -function deletePage(idx) {
    52  - if (confirm("Delete " + pages[idx].name + "?")) {
    53  - api.pageId.delete(pages[idx].id)
    54  - .success(function (data) {
    55  - successFlash(data.message)
    56  - load()
     51 +var deletePage = function (idx) {
     52 + swal({
     53 + title: "Are you sure?",
     54 + text: "This will delete the landing page. This can't be undone!",
     55 + type: "warning",
     56 + animation: false,
     57 + showCancelButton: true,
     58 + confirmButtonText: "Delete " + escapeHtml(pages[idx].name),
     59 + confirmButtonColor: "#428bca",
     60 + reverseButtons: true,
     61 + allowOutsideClick: false,
     62 + preConfirm: function () {
     63 + return new Promise(function (resolve, reject) {
     64 + api.pageId.delete(pages[idx].id)
     65 + .success(function (msg) {
     66 + resolve()
     67 + })
     68 + .error(function (data) {
     69 + reject(data.responseJSON.message)
     70 + })
    57 71   })
    58  - }
     72 + }
     73 + }).then(function () {
     74 + swal(
     75 + 'Landing Page Deleted!',
     76 + 'This landing page has been deleted!',
     77 + 'success'
     78 + );
     79 + $('button:contains("OK")').on('click', function () {
     80 + location.reload()
     81 + })
     82 + })
    59 83  }
    60 84   
    61 85  function importSite() {
    skipped 149 lines
  • ■ ■ ■ ■ ■
    static/js/src/app/sending_profiles.js
    skipped 101 lines
    102 102   $("#sendTestModalSubmit").html("<i class='fa fa-envelope'></i> Send")
    103 103  }
    104 104   
    105  -function deleteProfile(idx) {
    106  - if (confirm("Delete " + profiles[idx].name + "?")) {
    107  - api.SMTPId.delete(profiles[idx].id)
    108  - .success(function (data) {
    109  - successFlash(data.message)
    110  - load()
     105 + 
     106 +var deleteProfile = function (idx) {
     107 + swal({
     108 + title: "Are you sure?",
     109 + text: "This will delete the sending profile. This can't be undone!",
     110 + type: "warning",
     111 + animation: false,
     112 + showCancelButton: true,
     113 + confirmButtonText: "Delete " + escapeHtml(profiles[idx].name),
     114 + confirmButtonColor: "#428bca",
     115 + reverseButtons: true,
     116 + allowOutsideClick: false,
     117 + preConfirm: function () {
     118 + return new Promise(function (resolve, reject) {
     119 + api.SMTPId.delete(profiles[idx].id)
     120 + .success(function (msg) {
     121 + resolve()
     122 + })
     123 + .error(function (data) {
     124 + reject(data.responseJSON.message)
     125 + })
    111 126   })
    112  - }
     127 + }
     128 + }).then(function () {
     129 + swal(
     130 + 'Sending Profile Deleted!',
     131 + 'This sending profile has been deleted!',
     132 + 'success'
     133 + );
     134 + $('button:contains("OK")').on('click', function () {
     135 + location.reload()
     136 + })
     137 + })
    113 138  }
    114 139   
    115 140  function edit(idx) {
    skipped 143 lines
    259 284   if (
    260 285   this.$element[0] !== e.target && !this.$element.has(e.target).length
    261 286   // CKEditor compatibility fix start.
    262  - && !$(e.target).closest('.cke_dialog, .cke').length
     287 + &&
     288 + !$(e.target).closest('.cke_dialog, .cke').length
    263 289   // CKEditor compatibility fix end.
    264 290   ) {
    265 291   this.$element.trigger('focus');
    skipped 33 lines
    299 325   });
    300 326   load()
    301 327  })
    302  - 
  • ■ ■ ■ ■ ■ ■
    static/js/src/app/templates.js
    skipped 77 lines
    78 78   $("#modal").modal('hide')
    79 79  }
    80 80   
     81 +var deleteTemplate = function (idx) {
     82 + swal({
     83 + title: "Are you sure?",
     84 + text: "This will delete the template. This can't be undone!",
     85 + type: "warning",
     86 + animation: false,
     87 + showCancelButton: true,
     88 + confirmButtonText: "Delete " + escapeHtml(templates[idx].name),
     89 + confirmButtonColor: "#428bca",
     90 + reverseButtons: true,
     91 + allowOutsideClick: false,
     92 + preConfirm: function () {
     93 + return new Promise(function (resolve, reject) {
     94 + api.templateId.delete(templates[idx].id)
     95 + .success(function (msg) {
     96 + resolve()
     97 + })
     98 + .error(function (data) {
     99 + reject(data.responseJSON.message)
     100 + })
     101 + })
     102 + }
     103 + }).then(function () {
     104 + swal(
     105 + 'Template Deleted!',
     106 + 'This template has been deleted!',
     107 + 'success'
     108 + );
     109 + $('button:contains("OK")').on('click', function () {
     110 + location.reload()
     111 + })
     112 + })
     113 +}
     114 + 
    81 115  function deleteTemplate(idx) {
    82 116   if (confirm("Delete " + templates[idx].name + "?")) {
    83 117   api.templateId.delete(templates[idx].id)
    skipped 276 lines
  • ■ ■ ■ ■ ■
    static/js/src/app/users.js
    skipped 136 lines
    137 137   }
    138 138  }
    139 139   
    140  -function deleteGroup(id) {
     140 + 
     141 +var deleteGroup = function (id) {
    141 142   var group = groups.find(function (x) {
    142 143   return x.id === id
    143 144   })
    144 145   if (!group) {
    145  - console.log('wat');
    146 146   return
    147 147   }
    148  - if (confirm("Delete " + group.name + "?")) {
    149  - api.groupId.delete(id)
    150  - .success(function (data) {
    151  - successFlash(data.message)
    152  - load()
     148 + swal({
     149 + title: "Are you sure?",
     150 + text: "This will delete the group. This can't be undone!",
     151 + type: "warning",
     152 + animation: false,
     153 + showCancelButton: true,
     154 + confirmButtonText: "Delete " + escapeHtml(group.name),
     155 + confirmButtonColor: "#428bca",
     156 + reverseButtons: true,
     157 + allowOutsideClick: false,
     158 + preConfirm: function () {
     159 + return new Promise(function (resolve, reject) {
     160 + api.groupId.delete(id)
     161 + .success(function (msg) {
     162 + resolve()
     163 + })
     164 + .error(function (data) {
     165 + reject(data.responseJSON.message)
     166 + })
    153 167   })
    154  - }
     168 + }
     169 + }).then(function () {
     170 + swal(
     171 + 'Group Deleted!',
     172 + 'This group has been deleted!',
     173 + 'success'
     174 + );
     175 + $('button:contains("OK")').on('click', function () {
     176 + location.reload()
     177 + })
     178 + })
    155 179  }
    156 180   
    157 181  function addTarget(firstNameInput, lastNameInput, emailInput, positionInput) {
    skipped 100 lines
Please wait...
Page is in error, reload to recover