diff --git a/lib/client/menu.js b/lib/client/menu.js index c8cb1033..4eb9d98f 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -47,19 +47,33 @@ CloudCommander.Menu.getConfig = (function(){ }}, download: {name: 'Download',callback: function(key, opt){ + lThis.Images.showLoad(); var lCurrent = lThis.getCurrentFile(); - var lLink = lThis.getByTag('a', lCurrent)[0].href; - + var lLink = lThis.getByTag('a', lCurrent)[0].href; + console.log('downloadin file ' + lLink +'...'); - var lDownload = lThis.anyload({ - name : 'iframe', - className : 'hidden', - src : lLink + '?download' - }); - - document.body.removeChild(lDownload); + lLink = lLink + '?download'; + var lId = lThis.getIdBySrc(lLink); + if(!lThis.getById(lId)){ + var lDownload = lThis.anyload({ + name : 'iframe', + async : false, + className : 'hidden', + src : lLink + }); + + lThis.Images.hideLoad(); + setTimeout(function() { + document.body.removeChild(lDownload); + }, 10000); + } + else{ + lThis.Images.showError({ + responseText: 'Error: You trying to' + + 'download same file to often'}); + } }} } };