diff options
author | Jan-Christoph Borchardt <JanCBorchardt@fsfe.org> | 2011-07-07 01:27:16 +0200 |
---|---|---|
committer | Jan-Christoph Borchardt <JanCBorchardt@fsfe.org> | 2011-07-07 01:27:16 +0200 |
commit | e3fd72dc1627ef1cbfd4c525ea5428e68942e80a (patch) | |
tree | ce21e8d9a788bbb6710956709018067ff31ab391 /files/js | |
parent | aa3b76e3fb8e46182ca892d0e8bf468a8cf0c3a0 (diff) | |
download | nextcloud-server-e3fd72dc1627ef1cbfd4c525ea5428e68942e80a.tar.gz nextcloud-server-e3fd72dc1627ef1cbfd4c525ea5428e68942e80a.zip |
introducing simple file size, only MB as unit, details on hover
Diffstat (limited to 'files/js')
-rw-r--r-- | files/js/files.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/files/js/files.js b/files/js/files.js index b491b90275c..2434fceff43 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -128,7 +128,7 @@ $(document).ready(function() { $('#file_upload_submit').click(function(){ var name=$('#file_upload_filename').val(); if($('#file_upload_start')[0].files[0] && $('#file_upload_start')[0].files[0].size>0){ - var size=humanFileSize($('#file_upload_start')[0].files[0].size); + var size=simpleFileSize($('#file_upload_start')[0].files[0].size); }else{ var size='Pending'; } @@ -205,6 +205,14 @@ function humanFileSize(bytes){ return bytes+' GB'; } +function simpleFileSize(bytes) { + mbytes = Math.round(bytes/(1024*1024),1); + if(bytes == 0) { return '0'; } + else if(mbytes < 0.1) { return '< 0.1'; } + else if(mbytes > 1000) { return '> 1000'; } + else { return mbytes.toFixed(1); } +} + function formatDate(date){ var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; |