diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-02-25 21:19:32 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-26 03:10:29 +0100 |
commit | 797e921b9aa25f832718a3c44cfcb936f96c49df (patch) | |
tree | 890cdbcadc8f15a3fac7c1db53adbd2a1b7fc5ce /core | |
parent | a7d7597d552ce41aa7f9d77c751b9160224cf96a (diff) | |
download | nextcloud-server-797e921b9aa25f832718a3c44cfcb936f96c49df.tar.gz nextcloud-server-797e921b9aa25f832718a3c44cfcb936f96c49df.zip |
improve log browsing
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js index 6da9c29e693..076fbf04c78 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -444,4 +444,37 @@ $.fn.filterAttr = function(attr_name, attr_value) { return this.filter(function() { return $(this).attr(attr_name) === attr_value; }); }; +function humanFileSize(bytes){ + if( bytes < 1024 ){ + return bytes+' B'; + } + bytes = Math.round(bytes / 1024, 1 ); + if( bytes < 1024 ){ + return bytes+' kB'; + } + bytes = Math.round( bytes / 1024, 1 ); + if( bytes < 1024 ){ + return bytes+' MB'; + } + + // Wow, heavy duty for owncloud + bytes = Math.round( bytes / 1024, 1 ); + return bytes+' GB'; +} +function simpleFileSize(bytes) { + mbytes = Math.round(bytes/(1024*1024/10))/10; + 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){ + if(typeof date=='number'){ + date=new Date(date); + } + var monthNames = [ t('files','January'), t('files','February'), t('files','March'), t('files','April'), t('files','May'), t('files','June'), + t('files','July'), t('files','August'), t('files','September'), t('files','October'), t('files','November'), t('files','December') ]; + return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+date.getMinutes(); +} |