Browse Source

testing

master
Pascal Gloor 5 years ago
parent
commit
c869765a5a
1 changed files with 25 additions and 0 deletions
  1. 25
    0
      www/js/autodoc.js

+ 25
- 0
www/js/autodoc.js View File

@@ -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…
Cancel
Save