From 2b6805696092ab190319e0dd743894e80026b2de Mon Sep 17 00:00:00 2001 From: Simon de Almeida Date: Mon, 10 Apr 2017 17:01:49 -0400 Subject: [PATCH 1/7] Added Dialog prompt for single file import --- src/utils/DragAndDrop.js | 1 + src/widgets/Dialogs.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/utils/DragAndDrop.js b/src/utils/DragAndDrop.js index 317f1afab22..a40a533d8ff 100644 --- a/src/utils/DragAndDrop.js +++ b/src/utils/DragAndDrop.js @@ -48,6 +48,7 @@ define(function (require, exports, module) { // this is the path they want to use as a parent dir root. var _dropPathHint; + /** * Returns true if the drag and drop items contains valid drop objects. * @param {Array.} items Array of items being dragged diff --git a/src/widgets/Dialogs.js b/src/widgets/Dialogs.js index a527480f381..ccdc010664e 100644 --- a/src/widgets/Dialogs.js +++ b/src/widgets/Dialogs.js @@ -45,6 +45,7 @@ define(function (require, exports, module) { DIALOG_BTN_OK = "ok", DIALOG_BTN_DONTSAVE = "dontsave", DIALOG_BTN_SAVE_AS = "save_as", + DIALOG_BTN_IMPORT = "import", DIALOG_CANCELED = "_canceled", DIALOG_BTN_DOWNLOAD = "download"; @@ -447,6 +448,7 @@ define(function (require, exports, module) { window.addEventListener("resize", setDialogMaxSize); exports.DIALOG_BTN_CANCEL = DIALOG_BTN_CANCEL; + exports.DIALOG_BTN_IMPORT = DIALOG_BTN_IMPORT; exports.DIALOG_BTN_OK = DIALOG_BTN_OK; exports.DIALOG_BTN_DONTSAVE = DIALOG_BTN_DONTSAVE; exports.DIALOG_BTN_SAVE_AS = DIALOG_BTN_SAVE_AS; From fad3c8e1fcd2010361505347e7be552dbff06227 Mon Sep 17 00:00:00 2001 From: Simon de Almeida Date: Fri, 12 May 2017 18:14:31 -0400 Subject: [PATCH 2/7] Added warning if imported file overwrites local files. --- src/filesystem/impls/filer/ArchiveUtils.js | 126 +++++++++++++++--- .../impls/filer/lib/WebKitFileImport.js | 52 +++++++- src/utils/DragAndDrop.js | 3 +- 3 files changed, 158 insertions(+), 23 deletions(-) diff --git a/src/filesystem/impls/filer/ArchiveUtils.js b/src/filesystem/impls/filer/ArchiveUtils.js index eb88b2c30ff..40a5d316898 100644 --- a/src/filesystem/impls/filer/ArchiveUtils.js +++ b/src/filesystem/impls/filer/ArchiveUtils.js @@ -18,6 +18,14 @@ define(function (require, exports, module) { var Buffer = Filer.Buffer; var Path = Filer.Path; var fs = Filer.fs(); + var Dialogs = require("widgets/Dialogs"); + var DefaultDialogs = require("widgets/DefaultDialogs"); + var Strings = require("strings"); + var StringUtils = require("utils/StringUtils"); + + var CANCEL_OPERATION = -1, + OVERWRITE_OPERATION = 1, + KEEP_EXISTING_OPERATION = 2; // Mac and Windows clutter zip files with extra files/folders we don't need function skipFile(filename) { @@ -56,6 +64,48 @@ define(function (require, exports, module) { CommandManager.execute(Commands.FILE_REFRESH).always(callback); } + function showOverwriteWarning(path, callback) { + var filepath = stripRoot(path); + + Dialogs.showModalDialog( + DefaultDialogs.DIALOG_ID_INFO, + Strings.FILE_EXISTS_HEADER, + StringUtils.format(Strings.DND_FILE_REPLACE, filepath), + [{ + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_CANCEL, + text : Strings.CANCEL + }, + { + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_IMPORT, + text : Strings.USE_IMPORTED + }, + { + className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, + id : Dialogs.DIALOG_BTN_OK, + text : Strings.KEEP_EXISTING + }] + ).getPromise().then(function (id) { + var result; + if (id === Dialogs.DIALOG_BTN_IMPORT) { + result = OVERWRITE_OPERATION; + } else if (id === Dialogs.DIALOG_BTN_OK) { + result = KEEP_EXISTING_OPERATION; + } else if (id === Dialogs.DIALOG_BTN_CANCEL) { + result = CANCEL_OPERATION; + } + callback(null, result); + }, callback); + } + + function stripRoot(path) { + var root = StartupState.project("root"); + var rootRegex = new RegExp("^" + root + "\/?"); + + return path.replace(rootRegex, ""); + } + // zipfile can be a path (string) to a zipfile, or raw binary data. function unzip(zipfile, options, callback) { var projectPrefix = StartupState.project("zipFilenamePrefix").replace(/\/?$/, "/"); @@ -105,28 +155,42 @@ define(function (require, exports, module) { var basedir = Path.dirname(path.absPath); if(path.isDirectory) { - fs.mkdirp(path.absPath, callback); - } else { - // XXX: some zip files don't seem to be structured such that dirs - // get created before files. Create base dir if not there yet. - fs.stat(basedir, function(err, stats) { - if(err) { - if(err.code !== "ENOENT") { + return fs.mkdirp(path.absPath, callback); + } + + // XXX: some zip files don't seem to be structured such that dirs + // get created before files. Create base dir if not there yet. + fs.mkdirp(basedir, function (err) { + if (err) { + return callback(err); + } + + fs.stat(path.absPath, function(err, stats) { + if(err && err.code !== "ENOENT") { + return callback(err); + } + + if (stats.type !== "FILE") { + return callback(); + } + + showOverwriteWarning(path.absPath, function (err, result) { + if (err) { return callback(err); } - fs.mkdirp(basedir, function(err) { - if(err) { - return callback(err); - } - + if (result === OVERWRITE_OPERATION) { FilerUtils.writeFileAsBinary(path.absPath, path.data, callback); - }); - } else { - FilerUtils.writeFileAsBinary(path.absPath, path.data, callback); - } + } else if (result === KEEP_EXISTING_OPERATION) { + callback(); + } else if (result === CANCEL_OPERATION) { + callback(new Error("Operation Cancelled")); + } else { + callback(new Error("Unknown result: " + result)); + } + }); }); - } + }); } async.eachSeries(filenames, decompress, function(err) { @@ -245,11 +309,35 @@ define(function (require, exports, module) { } fs.mkdirp(basedir, function(err) { - if(err && err.code !== "EEXIST") { + if(err) { return callback(err); } - FilerUtils.writeFileAsBinary(path, new Buffer(data), callback); + fs.stat(path, function (err, stats) { + if (err && err.code !== "ENOENT") { + return callback(err); + } + + if (stats.type !== "FILE") { + return callback(); + } + + showOverwriteWarning(path, function (err, result) { + if (err) { + return callback(err); + } + + if (result === OVERWRITE_OPERATION) { + FilerUtils.writeFileAsBinary(path, new Buffer(data), callback); + } else if (result === KEEP_EXISTING_OPERATION) { + callback(); + } else if (result === CANCEL_OPERATION) { + callback(new Error("Operation Cancelled")); + } else { + callback(new Error("Unknown result: " + result)); + } + }); + }); }); } diff --git a/src/filesystem/impls/filer/lib/WebKitFileImport.js b/src/filesystem/impls/filer/lib/WebKitFileImport.js index db8b8409836..b7ba8a15609 100644 --- a/src/filesystem/impls/filer/lib/WebKitFileImport.js +++ b/src/filesystem/impls/filer/lib/WebKitFileImport.js @@ -37,6 +37,7 @@ define(function (require, exports, module) { Strings = require("strings"), Filer = require("filesystem/impls/filer/BracketsFiler"), Path = Filer.Path, + fs = Filer.fs(), Content = require("filesystem/impls/filer/lib/content"), ArchiveUtils = require("filesystem/impls/filer/ArchiveUtils"); @@ -125,13 +126,13 @@ define(function (require, exports, module) { }); } - function handleRegularFile(deferred, file, filename, buffer, encoding) { + function saveFile(deferred, file, filename, buffer, encoding) { file.write(buffer, {encoding: encoding}, function(err) { if (err) { onError(deferred, filename, err); return; } - + // See if this file is worth trying to open in the editor or not if(shouldOpenFile(filename, encoding)) { pathList.push(filename); @@ -141,11 +142,55 @@ define(function (require, exports, module) { }); } + function handleRegularFile(deferred, file, filename, buffer, encoding) { + fs.exists(filename, function(doesExist) { + if (doesExist) { + console.log("File: ", filename, " already exists!"); + + // File exists. Prompt user for action + Dialogs.showModalDialog( + DefaultDialogs.DIALOG_ID_INFO, + Strings.FILE_EXISTS_HEADER, + StringUtils.format(Strings.DND_FILE_REPLACE, FileUtils.getBaseName(filename)), + [ + { + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_CANCEL, + text : Strings.CANCEL + }, + { + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_IMPORT, + text : Strings.USE_IMPORTED + }, + { + className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, + id : Dialogs.DIALOG_BTN_OK, + text : Strings.KEEP_EXISTING + } + ] + ) + .done(function(id) { + if (id === Dialogs.DIALOG_BTN_IMPORT) { + // Override file per user's request + saveFile(deferred, file, filename, buffer, encoding); + } + }); + } else { + // File doesn't exist. Save without prompt + saveFile(deferred, file, filename, buffer, encoding); + } + }); + } + function handleZipFile(deferred, file, filename, buffer, encoding) { var basename = Path.basename(filename); ArchiveUtils.unzip(buffer, { root: parentPath }, function(err) { if (err) { + if (err.message === "Operation Cancelled") { + return deferred.resolve(); + } onError(deferred, filename, new Error(Strings.DND_ERROR_UNZIP)); return; } @@ -159,6 +204,9 @@ define(function (require, exports, module) { ArchiveUtils.untar(buffer, { root: parentPath }, function(err) { if (err) { + if (err.message === "Operation Cancelled") { + return deferred.resolve(); + } onError(deferred, filename, new Error(Strings.DND_ERROR_UNTAR)); return; } diff --git a/src/utils/DragAndDrop.js b/src/utils/DragAndDrop.js index a40a533d8ff..96faa8effc3 100644 --- a/src/utils/DragAndDrop.js +++ b/src/utils/DragAndDrop.js @@ -48,7 +48,6 @@ define(function (require, exports, module) { // this is the path they want to use as a parent dir root. var _dropPathHint; - /** * Returns true if the drag and drop items contains valid drop objects. * @param {Array.} items Array of items being dragged @@ -142,7 +141,6 @@ define(function (require, exports, module) { return Async.doInParallel(paths, function (path, idx) { var result = new $.Deferred(); - // Only open files. FileSystem.resolve(path, function (err, item) { if (!err && item.isFile) { @@ -184,6 +182,7 @@ define(function (require, exports, module) { return result.promise(); }, false) .fail(function () { + console.log("fail"); function errorToString(err) { if (err === ERR_MULTIPLE_ITEMS_WITH_DIR) { return Strings.ERROR_MIXED_DRAGDROP; From 219f70f082343e9e907c9e2b1319b05c013d0440 Mon Sep 17 00:00:00 2001 From: Simon de Almeida Date: Fri, 12 May 2017 19:25:57 -0400 Subject: [PATCH 3/7] Fixed Cancel on tar archives --- src/filesystem/impls/filer/ArchiveUtils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/filesystem/impls/filer/ArchiveUtils.js b/src/filesystem/impls/filer/ArchiveUtils.js index 40a5d316898..34bff693817 100644 --- a/src/filesystem/impls/filer/ArchiveUtils.js +++ b/src/filesystem/impls/filer/ArchiveUtils.js @@ -350,6 +350,10 @@ define(function (require, exports, module) { function writeCallback(err) { if(err) { + if (err.message === "Operation Cancelled") { + finish(err); + return; + } console.error("[Bramble untar] couldn't extract file", err); } From 63fa04290de71b0fa2da0c5839b231fa8efdc13a Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Thu, 20 Jul 2017 12:29:01 -0400 Subject: [PATCH 4/7] Fix a few bugs, integrate with rebased code. --- src/filesystem/impls/filer/ArchiveUtils.js | 8 ++++++-- src/filesystem/impls/filer/lib/WebKitFileImport.js | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/filesystem/impls/filer/ArchiveUtils.js b/src/filesystem/impls/filer/ArchiveUtils.js index 34bff693817..92a240fd5c5 100644 --- a/src/filesystem/impls/filer/ArchiveUtils.js +++ b/src/filesystem/impls/filer/ArchiveUtils.js @@ -166,8 +166,12 @@ define(function (require, exports, module) { } fs.stat(path.absPath, function(err, stats) { - if(err && err.code !== "ENOENT") { - return callback(err); + if(err) { + if(err.code !== "ENOENT") { + return callback(err); + } + + return FilerUtils.writeFileAsBinary(path.absPath, path.data, callback); } if (stats.type !== "FILE") { diff --git a/src/filesystem/impls/filer/lib/WebKitFileImport.js b/src/filesystem/impls/filer/lib/WebKitFileImport.js index b7ba8a15609..f352543a1bd 100644 --- a/src/filesystem/impls/filer/lib/WebKitFileImport.js +++ b/src/filesystem/impls/filer/lib/WebKitFileImport.js @@ -35,6 +35,7 @@ define(function (require, exports, module) { FileSystem = require("filesystem/FileSystem"), FileUtils = require("file/FileUtils"), Strings = require("strings"), + StringUtils = require("utils/StringUtils"), Filer = require("filesystem/impls/filer/BracketsFiler"), Path = Filer.Path, fs = Filer.fs(), @@ -132,7 +133,7 @@ define(function (require, exports, module) { onError(deferred, filename, err); return; } - + // See if this file is worth trying to open in the editor or not if(shouldOpenFile(filename, encoding)) { pathList.push(filename); From 2de5d930ade36ea10378ca43e39fd43e356184f0 Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Thu, 20 Jul 2017 14:57:29 -0400 Subject: [PATCH 5/7] More fixes --- locales/en-US/editor.properties | 1 - .../impls/filer/lib/LegacyFileImport.js | 52 +++++++++++++-- .../impls/filer/lib/WebKitFileImport.js | 65 +++++++++---------- src/utils/DragAndDrop.js | 2 +- 4 files changed, 78 insertions(+), 42 deletions(-) diff --git a/locales/en-US/editor.properties b/locales/en-US/editor.properties index de1db5f829b..6f117bc34bb 100644 --- a/locales/en-US/editor.properties +++ b/locales/en-US/editor.properties @@ -26,7 +26,6 @@ ERROR_PROJECT_SIZE_EXCEEDED=The total size of the files in your project has exce # File Open/Save Error strings -FILE_EXISTS_HEADER=The file already exists. # The {0} here will be replaced by an actual error message OPEN_DIALOG_ERROR=An error occurred when showing the open file dialog. (error {0}) # {0} will be replaced with a filename and {1} will be replaced by an error message diff --git a/src/filesystem/impls/filer/lib/LegacyFileImport.js b/src/filesystem/impls/filer/lib/LegacyFileImport.js index f68b4d112dd..ee3c2317e98 100644 --- a/src/filesystem/impls/filer/lib/LegacyFileImport.js +++ b/src/filesystem/impls/filer/lib/LegacyFileImport.js @@ -57,13 +57,7 @@ define(function (require, exports, module) { return Content.isImage(Path.extname(filename)) || encoding === "utf8"; } - function handleRegularFile(deferred, file, filename, buffer, encoding) { - // Don't write thing like .DS_Store, thumbs.db, etc. - if(ArchiveUtils.skipFile(filename)) { - deferred.resolve(); - return; - } - + function saveFile(deferred, file, filename, buffer, encoding) { file.write(buffer, {encoding: encoding}, function(err) { if (err) { errorList.push({path: filename, error: "unable to write file: " + err.message || ""}); @@ -80,6 +74,50 @@ define(function (require, exports, module) { }); } + function handleRegularFile(deferred, file, filename, buffer, encoding) { + // Don't write thing like .DS_Store, thumbs.db, etc. + if(ArchiveUtils.skipFile(filename)) { + deferred.resolve(); + return; + } + + fs.exists(filename, function(doesExist) { + if (!doesExist) { + // File doesn't exist. Save without prompt + saveFile(deferred, file, filename, buffer, encoding); + return; + } + + // File exists. Prompt user for action + Dialogs.showModalDialog( + DefaultDialogs.DIALOG_ID_INFO, + Strings.FILE_EXISTS_HEADER, + StringUtils.format(Strings.DND_FILE_REPLACE, FileUtils.getBaseName(filename)), + [{ + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_CANCEL, + text : Strings.CANCEL + }, + { + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_IMPORT, + text : Strings.USE_IMPORTED + }, + { + className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, + id : Dialogs.DIALOG_BTN_OK, + text : Strings.KEEP_EXISTING + }] + ) + .done(function(id) { + if (id === Dialogs.DIALOG_BTN_IMPORT) { + // Override file per user's request + saveFile(deferred, file, filename, buffer, encoding); + } + }); + }); + } + function handleZipFile(deferred, file, filename, buffer, encoding) { var basename = Path.basename(filename); diff --git a/src/filesystem/impls/filer/lib/WebKitFileImport.js b/src/filesystem/impls/filer/lib/WebKitFileImport.js index f352543a1bd..a21fb0b29a5 100644 --- a/src/filesystem/impls/filer/lib/WebKitFileImport.js +++ b/src/filesystem/impls/filer/lib/WebKitFileImport.js @@ -145,42 +145,41 @@ define(function (require, exports, module) { function handleRegularFile(deferred, file, filename, buffer, encoding) { fs.exists(filename, function(doesExist) { - if (doesExist) { - console.log("File: ", filename, " already exists!"); - - // File exists. Prompt user for action - Dialogs.showModalDialog( - DefaultDialogs.DIALOG_ID_INFO, - Strings.FILE_EXISTS_HEADER, - StringUtils.format(Strings.DND_FILE_REPLACE, FileUtils.getBaseName(filename)), - [ - { - className : Dialogs.DIALOG_BTN_CLASS_NORMAL, - id : Dialogs.DIALOG_BTN_CANCEL, - text : Strings.CANCEL - }, - { - className : Dialogs.DIALOG_BTN_CLASS_NORMAL, - id : Dialogs.DIALOG_BTN_IMPORT, - text : Strings.USE_IMPORTED - }, - { - className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, - id : Dialogs.DIALOG_BTN_OK, - text : Strings.KEEP_EXISTING - } - ] - ) - .done(function(id) { - if (id === Dialogs.DIALOG_BTN_IMPORT) { - // Override file per user's request - saveFile(deferred, file, filename, buffer, encoding); - } - }); - } else { + if (!doesExist) { // File doesn't exist. Save without prompt saveFile(deferred, file, filename, buffer, encoding); + return; } + + // File exists. Prompt user for action + Dialogs.showModalDialog( + DefaultDialogs.DIALOG_ID_INFO, + Strings.FILE_EXISTS_HEADER, + StringUtils.format(Strings.DND_FILE_REPLACE, FileUtils.getBaseName(filename)), + [ + { + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_CANCEL, + text : Strings.CANCEL + }, + { + className : Dialogs.DIALOG_BTN_CLASS_NORMAL, + id : Dialogs.DIALOG_BTN_IMPORT, + text : Strings.USE_IMPORTED + }, + { + className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, + id : Dialogs.DIALOG_BTN_OK, + text : Strings.KEEP_EXISTING + } + ] + ) + .done(function(id) { + if (id === Dialogs.DIALOG_BTN_IMPORT) { + // Override file per user's request + saveFile(deferred, file, filename, buffer, encoding); + } + }); }); } diff --git a/src/utils/DragAndDrop.js b/src/utils/DragAndDrop.js index 96faa8effc3..317f1afab22 100644 --- a/src/utils/DragAndDrop.js +++ b/src/utils/DragAndDrop.js @@ -141,6 +141,7 @@ define(function (require, exports, module) { return Async.doInParallel(paths, function (path, idx) { var result = new $.Deferred(); + // Only open files. FileSystem.resolve(path, function (err, item) { if (!err && item.isFile) { @@ -182,7 +183,6 @@ define(function (require, exports, module) { return result.promise(); }, false) .fail(function () { - console.log("fail"); function errorToString(err) { if (err === ERR_MULTIPLE_ITEMS_WITH_DIR) { return Strings.ERROR_MIXED_DRAGDROP; From d9c7fc789ea3717a8395db4b139c3782d07e8896 Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Thu, 20 Jul 2017 15:10:20 -0400 Subject: [PATCH 6/7] Fix for travis --- locales/en-US/editor.properties | 1 + src/filesystem/impls/filer/lib/LegacyFileImport.js | 1 + 2 files changed, 2 insertions(+) diff --git a/locales/en-US/editor.properties b/locales/en-US/editor.properties index 6f117bc34bb..de1db5f829b 100644 --- a/locales/en-US/editor.properties +++ b/locales/en-US/editor.properties @@ -26,6 +26,7 @@ ERROR_PROJECT_SIZE_EXCEEDED=The total size of the files in your project has exce # File Open/Save Error strings +FILE_EXISTS_HEADER=The file already exists. # The {0} here will be replaced by an actual error message OPEN_DIALOG_ERROR=An error occurred when showing the open file dialog. (error {0}) # {0} will be replaced with a filename and {1} will be replaced by an error message diff --git a/src/filesystem/impls/filer/lib/LegacyFileImport.js b/src/filesystem/impls/filer/lib/LegacyFileImport.js index ee3c2317e98..c7a26829b55 100644 --- a/src/filesystem/impls/filer/lib/LegacyFileImport.js +++ b/src/filesystem/impls/filer/lib/LegacyFileImport.js @@ -38,6 +38,7 @@ define(function (require, exports, module) { StringUtils = require("utils/StringUtils"), Filer = require("filesystem/impls/filer/BracketsFiler"), Path = Filer.Path, + fs = Filer.fs(), Content = require("filesystem/impls/filer/lib/content"), ArchiveUtils = require("filesystem/impls/filer/ArchiveUtils"); From 508d05bd9824dc411bfe92285bba82ea57fd21fe Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Fri, 21 Jul 2017 10:24:10 -0400 Subject: [PATCH 7/7] Hide upload dialog once importing is happening --- src/extensions/default/UploadFiles/UploadFilesDialog.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/extensions/default/UploadFiles/UploadFilesDialog.js b/src/extensions/default/UploadFiles/UploadFilesDialog.js index 8d92f897370..09c082f2342 100644 --- a/src/extensions/default/UploadFiles/UploadFilesDialog.js +++ b/src/extensions/default/UploadFiles/UploadFilesDialog.js @@ -97,10 +97,7 @@ define(function (require, exports, module) { // Turn off the other buttons $fromComputerButton.off("click", self._handleFromComputer.bind(self)); $takeSelfieButton.off("click", self._handleTakeSelfie.bind(self)); - - // Switch to the upload spinner - $dragFilesAreaDiv.hide(); - $uploadFilesDiv.show(); + self.hide(); }, onfilesdone: function() { self.hide();