diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-07-07 15:16:37 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-07 15:16:37 +0200 |
commit | 3f5aa27d494d56217980195534ee999b5e473ca5 (patch) | |
tree | 619a559284179afbb680a6f08d8a6b3bf8855c94 /apps/files/js/filelist.js | |
parent | 3d8297c25473c5496fa7e27f600f1e23053df2fc (diff) | |
download | nextcloud-server-3f5aa27d494d56217980195534ee999b5e473ca5.tar.gz nextcloud-server-3f5aa27d494d56217980195534ee999b5e473ca5.zip |
refactoring into proper methods
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 86c6e225115..c018777d8a8 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -426,37 +426,9 @@ return; } - downloadFileaction.addClass('disabled'); - var icon = downloadFileaction.find('img'); - var sourceImage = icon.attr('src'); - icon.attr('src', sourceImage.replace('actions/download.svg', 'loading-small.gif')); - - var randomString = Math.random().toString(36).substring(2); - - var isCookieSet = function(name, value) { - var cookies = document.cookie.split(';'); - for (var i=0; i < cookies.length; i++) { - var cookie = cookies[i].split('='); - if (cookie[0].trim() === name && cookie[1].trim() === value) { - return true; - } - } - return false; - }; - - var checkForDownloadCookie = function() { - console.log('check'); - if (!isCookieSet('ocDownloadStarted', randomString)){ - setTimeout(checkForDownloadCookie, 500); - } else { - console.log('boom'); - icon.attr('src', sourceImage); - downloadFileaction.removeClass('disabled'); - } - }; + var randomString = OCA.Files.Files.handleDownloadSpinner(downloadFileaction); OC.redirect(this.getDownloadUrl(files, dir) + '&downloadStartSecret=' + randomString); - checkForDownloadCookie(); return false; }, |