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/fileactions.js | |
parent | 3d8297c25473c5496fa7e27f600f1e23053df2fc (diff) | |
download | nextcloud-server-3f5aa27d494d56217980195534ee999b5e473ca5.tar.gz nextcloud-server-3f5aa27d494d56217980195534ee999b5e473ca5.zip |
refactoring into proper methods
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 6678c2d5b34..78f195be91f 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -486,36 +486,10 @@ 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() { - if (!isCookieSet('ocDownloadStarted', randomString)){ - setTimeout(checkForDownloadCookie, 500); - } else { - icon.attr('src', sourceImage); - downloadFileaction.removeClass('disabled'); - } - }; + var randomString = OCA.Files.Files.handleDownloadSpinner(downloadFileaction); if (url) { OC.redirect(url + '&downloadStartSecret=' + randomString); - checkForDownloadCookie(); } }, t('files', 'Download')); } |