Adds upload target selection. Currently there's "document" and "limbo", while "document-extId" is not yet ready.
This commit is contained in:
parent
3d3a5585b0
commit
1bdce2e9cf
1 changed files with 64 additions and 53 deletions
|
@ -1,8 +1,12 @@
|
|||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const dropzone = document.querySelector('html');
|
||||
const targetContainer = document.querySelector('#dropzone')
|
||||
|
||||
let progressDialog = document.querySelector('#upload_progress_dialog')
|
||||
let progressBar = document.querySelector('#upload_progress')
|
||||
if (targetContainer !== null) {
|
||||
const target = targetContainer.dataset.target;
|
||||
|
||||
const progressDialog = document.querySelector('#upload_progress_dialog')
|
||||
const progressBar = document.querySelector('#upload_progress')
|
||||
|
||||
dropzone.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
|
@ -58,9 +62,16 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
alert("Upload has been cancelled.")
|
||||
});
|
||||
|
||||
xhr.open('POST', '/upload?target=document', false);
|
||||
let url;
|
||||
|
||||
if (target === "document") url = '/upload?target=document';
|
||||
else if (target === "limbo") url = '/upload?target=limbo';
|
||||
else if (target.matches("document-[a-zA-Z0-9]")) url = '/upload?target=' + target;
|
||||
|
||||
xhr.open('POST', url, false);
|
||||
xhr.send(formData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue