fup: add drag and drop uploads
There's no UI indication that this is happening yet, but...
This commit is contained in:
parent
bb31335319
commit
01fb49549b
1 changed files with 28 additions and 0 deletions
|
@ -118,4 +118,32 @@ if (document.body.classList.contains('upload-page')) {
|
||||||
uploadFile(file, expiryEl.value);
|
uploadFile(file, expiryEl.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.body.addEventListener('dragenter', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
document.body.classList.add('dragging-over');
|
||||||
|
}, false);
|
||||||
|
document.body.addEventListener('dragover', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
document.body.classList.add('dragging-over');
|
||||||
|
}, false);
|
||||||
|
document.body.addEventListener('dragleave', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
document.body.classList.remove('dragging-over');
|
||||||
|
}, false);
|
||||||
|
document.body.addEventListener('drop', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
document.body.classList.remove('dragging-over');
|
||||||
|
|
||||||
|
const dt = e.dataTransfer;
|
||||||
|
const files = dt.files;
|
||||||
|
|
||||||
|
for (const f of files) {
|
||||||
|
uploadFile(f, expiryEl.value);
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue