1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

added file op:rename, cp, mv, upload, create

This commit is contained in:
llj
2012-07-02 10:21:17 +08:00
parent 4cd0a2cc44
commit 8b40a83880
37 changed files with 5991 additions and 36 deletions

View File

@@ -73,3 +73,36 @@ function addAutocomplete(ele_id, container_id, data) {
});
}
function filesizeformat(bytes, precision)
{
var kilobyte = 1024;
var megabyte = kilobyte * 1024;
var gigabyte = megabyte * 1024;
var terabyte = gigabyte * 1024;
if (precision === undefined)
precision = 0;
if ((bytes >= 0) && (bytes < kilobyte)) {
return bytes + ' B';
} else if ((bytes >= kilobyte) && (bytes < megabyte)) {
return (bytes / kilobyte).toFixed(precision) + ' KB';
} else if ((bytes >= megabyte) && (bytes < gigabyte)) {
return (bytes / megabyte).toFixed(precision) + ' MB';
} else if ((bytes >= gigabyte) && (bytes < terabyte)) {
return (bytes / gigabyte).toFixed(precision) + ' GB';
} else if (bytes >= terabyte) {
return (bytes / terabyte).toFixed(precision) + ' TB';
} else {
return bytes + ' B';
}
}
function e(str) {
return encodeURIComponent(str);
}