瀏覽代碼

testing

master
Pascal Gloor 5 年之前
父節點
當前提交
c869765a5a
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25
    0
      www/js/autodoc.js

+ 25
- 0
www/js/autodoc.js 查看文件

@@ -241,10 +241,35 @@ function upload_handler() {

function upload_read_event(e) {
if ( e.type == 'progress' ) {
if ( e.lengthComputable ) {
var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50);
if ( progress < 1 ) { progress = 1; }
if ( progress > 49 ) { progress = 49; }
temp.upload[e.data]['progress'] = progress;
}
}
else if ( e.type == 'load' ) {
var xhr = new XMLHttpRequest();
temp.upload[e.data]['progress'] = 50;
$(xhr.upload).on('progress', e.id, function(e) {
if ( e.lengthComputable ) {
var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50);
if ( progress < 1 ) { progress = 1; }
if ( progress > 49 ) { progress = 49; }
temp.upload[e.data]['progress'] = 50 + progress;
}
});

$(xhr.upload).on('load', e.id, function(e) {
temp.upload[e.data]['progress'] = 100;
console.log(e);
});

xhr.open("POST", conf.openapi + "/documents/" + temp.documentid + "/data");
xhr.send(e.target.result);
}

console.log(e);

Loading…
取消
儲存