1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 17:02:47 +00:00

Improve upload module 2 (#3984)

* optimized upload file

* improve upload

* revert code

* optimized code

* optimized code

* optimized code

* optimized code

* update resumablejs version
This commit is contained in:
杨顺强
2019-08-15 14:52:08 +08:00
committed by Daniel Pan
parent 04e10f3a4c
commit 68d3a57e7d
7 changed files with 317 additions and 107 deletions

View File

@@ -989,11 +989,38 @@ export const Utils = {
return false;
},
registerGlobalVariable(namespace, key, value) {
registerGlobalVariable: function(namespace, key, value) {
if (!window[namespace]) {
window[namespace] = {};
}
window[namespace][key] = value;
},
formatTime: function(seconds) {
var ss = parseInt(seconds);
var mm = 0;
var hh = 0;
if (ss > 60) {
mm = parseInt(ss / 60);
ss = parseInt(ss % 60);
}
if (mm > 60) {
hh = parseInt(mm / 60);
mm = parseInt(mm % 60);
}
var result = ('00' + parseInt(ss)).slice(-2);
if (mm > 0) {
result = ('00' + parseInt(mm)).slice(-2) + ':' + result;
} else {
result = '00:' + result;
}
if (hh > 0) {
result = ('00' + parseInt(hh)).slice(-2) + ':' + result;
} else {
result = '00:' + result;
}
return result;
}
};