diff --git a/lib/client/menu.js b/lib/client/menu.js index df1786b4..d91ccab0 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -282,35 +282,38 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO; date = Date.now(), files = DOM.getActiveFiles(); - files.forEach(function(file) { - var element, - selected = DOM.isSelected(file), - path = DOM.getCurrentPath(file), - id = DOM.load.getIdBySrc(path), - isDir = DOM.isCurrentIsDir(file); - - CloudCmd.log('downloading file ' + path + '...'); - - if (isDir) - path = apiURL + '/pack' + path + '.tar.gz'; - else - path = apiURL + FS + path + '?download'; - - element = DOM.load({ - id : id + '-' + date, - name : 'iframe', - async : false, - className : 'hidden', - src : path + if (!files.length) + DOM.Dialog.alert.noFiles(); + else + files.forEach(function(file) { + var element, + selected = DOM.isSelected(file), + path = DOM.getCurrentPath(file), + id = DOM.load.getIdBySrc(path), + isDir = DOM.isCurrentIsDir(file); + + CloudCmd.log('downloading file ' + path + '...'); + + if (isDir) + path = apiURL + '/pack' + path + '.tar.gz'; + else + path = apiURL + FS + path + '?download'; + + element = DOM.load({ + id : id + '-' + date, + name : 'iframe', + async : false, + className : 'hidden', + src : path + }); + + setTimeout(function() { + document.body.removeChild(element); + }, TIME); + + if (selected) + DOM.toggleSelectedFile(file); }); - - setTimeout(function() { - document.body.removeChild(element); - }, TIME); - - if (selected) - DOM.toggleSelectedFile(file); - }); } function getCurrentPosition() {