summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-25 21:19:32 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-26 03:10:29 +0100
commit797e921b9aa25f832718a3c44cfcb936f96c49df (patch)
tree890cdbcadc8f15a3fac7c1db53adbd2a1b7fc5ce /core
parenta7d7597d552ce41aa7f9d77c751b9160224cf96a (diff)
downloadnextcloud-server-797e921b9aa25f832718a3c44cfcb936f96c49df.tar.gz
nextcloud-server-797e921b9aa25f832718a3c44cfcb936f96c49df.zip
improve log browsing
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js33
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();
+}