aboutsummaryrefslogtreecommitdiff
path: root/qc_app/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app/static/js')
-rw-r--r--qc_app/static/js/upload_progress.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/qc_app/static/js/upload_progress.js b/qc_app/static/js/upload_progress.js
index 049dbfe..98a503a 100644
--- a/qc_app/static/js/upload_progress.js
+++ b/qc_app/static/js/upload_progress.js
@@ -35,6 +35,15 @@ function make_progress_updater(file, indicator_elt) {
};
}
+function setup_cancel_upload(request, indicator_elt) {
+ document.getElementById("btn-cancel-upload").addEventListener(
+ "click", function(event) {
+ event.preventDefault();
+ request.abort();
+ indicator_elt.setAttribute("class", "hidden");
+ });
+}
+
function setup_request(file, progress_indicator_elt) {
var request = new XMLHttpRequest();
var updater = make_progress_updater(file, progress_indicator_elt);
@@ -42,6 +51,7 @@ function setup_request(file, progress_indicator_elt) {
request.onload = function(event) {
document.location.assign(request.responseURL);
};
+ setup_cancel_upload(request, progress_indicator_elt)
return request;
}