Revision c3c625ae
Von Sven Schöling vor mehr als 3 Jahren hinzugefügt
- ID c3c625ae684c281278a60f58a1287c60e7ee47b3
- Vorgänger 74f9067a
js/kivi.ImageUpload.js | ||
---|---|---|
77 | 77 |
|
78 | 78 |
let xhr = new XMLHttpRequest; |
79 | 79 |
xhr.open('POST', 'controller.pl', true); |
80 |
xhr.success = ns.attSuccess; |
|
81 |
xhr.progress = ns.attProgress; |
|
82 |
xhr.error = ns.attFailed; |
|
83 |
xhr.abort = ns.attCanceled; |
|
84 | 80 |
xhr.send(data); |
81 |
xhr.addEventListener("load", ns.attSuccess); |
|
82 |
xhr.addEventListener("progress", ns.attProgress); |
|
83 |
xhr.addEventListener("error", ns.attFailed); |
|
84 |
xhr.addEventListener("abort", ns.attCanceled); |
|
85 | 85 |
}); |
86 | 86 |
}); |
87 | 87 |
}; |
... | ... | |
89 | 89 |
ns.attProgress = function(event) { |
90 | 90 |
if (event.lengthComputable) { |
91 | 91 |
var percentComplete = (event.loaded / event.total) * 100; |
92 |
$("#upload_result").html(percentComplete+" % "+ kivi.t8("uploaded")); |
|
92 |
$("#upload_progress div").style("width", percentComplete + "%"); |
|
93 |
} else { |
|
94 |
$("#upload_progress div").removeClass("determinate").addClass("indeterminate"); |
|
93 | 95 |
} |
94 | 96 |
}; |
95 | 97 |
|
Auch abrufbar als: Unified diff
ImageUpload: progress modal