aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/js/files.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/js/files.js')
-rw-r--r--src/main/resources/js/files.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/resources/js/files.js b/src/main/resources/js/files.js
index 4ef5bcc..c3fa1b1 100644
--- a/src/main/resources/js/files.js
+++ b/src/main/resources/js/files.js
@@ -35,7 +35,8 @@ drop.addEventListener('drop', e => {
row.insertCell(2).innerHTML = bytesToSize(file.size);
row.insertCell(3).innerHTML = `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
row.insertCell(4).innerHTML = "<td><button class='share'><i class='icon ion-md-share'></i></button></td>";
- row.insertCell(5).innerHTML = "<td><button class='delete'><i class='icon ion-md-trash'></i></button></td>";
+ row.insertCell(5).innerHTML = "<button class='downloadButton'><a class='download' href='" + file.name + "' download='" + file.name + "'><i class='icon ion-md-download'></i></a></button>";
+ row.insertCell(6).innerHTML = "<td><button class='delete'><i class='icon ion-md-trash'></i></button></td>";
setListeners();
@@ -180,6 +181,20 @@ function setListeners() {
})
});
+ // download button
+ document.querySelectorAll(".download").forEach(element => {
+ element.addEventListener("click", e => {
+ e.stopPropagation();
+ })
+ });
+ document.querySelectorAll(".downloadButton").forEach(element => {
+ element.addEventListener("click", e => {
+ console.log(e);
+ e.stopPropagation();
+ e.target.children[0].click()
+ })
+ });
+
// share button
document.querySelectorAll(".share").forEach(element => {
element.addEventListener("click", e => {