function FileUpload(app) { this.app = app; this.files = []; this.currentFile = 0; } FileUpload.prototype.listen = function() { var dropzone = document.getElementById("file-dropzone"); var self = this; if (dropzone) { dropzone.ondragover = dropzone.ondragenter = function(e) { e.stopPropagation(); e.preventDefault(); } dropzone.ondrop = function(e) { e.stopPropagation(); e.preventDefault(); self.files = e.dataTransfer.files; self.show(); $("#file-error-max-size").hide(); } $(document).on("click", "#file-browser", function(e) { e.preventDefault(); $("#file-form-element").get(0).click(); }); $(document).on("click", "#file-upload-button", function(e) { e.preventDefault(); self.currentFile = 0; self.checkFiles(); }); $("#file-form-element").change(function() { self.files = document.getElementById("file-form-element").files; self.show(); $("#file-error-max-size").hide(); }); } }; FileUpload.prototype.show = function() { $("#file-list").remove(); if (this.files.length > 0) { $("#file-upload-button").prop("disabled", false); $("#file-dropzone-inner").hide(); var ul = jQuery("