diff options
author | cbdev <cb@cbcdn.com> | 2023-08-13 21:15:24 +0200 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2023-08-13 21:15:24 +0200 |
commit | 0c3ab4200dbb58038ac2ec4a4cdd78729a7e21b3 (patch) | |
tree | d98beb75b064f0cd22d08597ba2c37d1fd48a997 /assets | |
parent | be37d4f7d7a09959f56f735d080b1cf7d4cf0f18 (diff) | |
download | cargohold-0c3ab4200dbb58038ac2ec4a4cdd78729a7e21b3.tar.gz cargohold-0c3ab4200dbb58038ac2ec4a4cdd78729a7e21b3.tar.bz2 cargohold-0c3ab4200dbb58038ac2ec4a4cdd78729a7e21b3.zip |
Implement download all button
Diffstat (limited to 'assets')
-rw-r--r-- | assets/admin.css | 9 | ||||
-rw-r--r-- | assets/cargohold.css | 20 | ||||
-rw-r--r-- | assets/cargohold.js | 20 |
3 files changed, 38 insertions, 11 deletions
diff --git a/assets/admin.css b/assets/admin.css index bf93fbc..bfa854c 100644 --- a/assets/admin.css +++ b/assets/admin.css @@ -26,15 +26,6 @@ div.entry { vertical-align: center; } -a.button { - padding: 0.5em; - background-color: #c8e; - text-decoration: none; - margin-left: 0.5em; - /*display: block;*/ - border-radius: 0.5em; -} - .info, .permission { padding: 0.5em; background-color: #c8e; diff --git a/assets/cargohold.css b/assets/cargohold.css index df40b98..eddd1c7 100644 --- a/assets/cargohold.css +++ b/assets/cargohold.css @@ -56,7 +56,7 @@ html { } #dirlisting { - padding: 2em; + padding: 0 2em 2em 2em; } #storage { @@ -113,6 +113,24 @@ html { width: 85%; } +a.button { + padding: 0.5em; + background-color: #c8e; + text-decoration: none; + margin-left: 0.5em; + border-radius: 0.5em; +} + +.buttonrow { + display: block; + text-align: right; + padding: 0.5em; +} + +.buttonrow > a { + display: inline-block; +} + .tab-wrap > input { display: none; } diff --git a/assets/cargohold.js b/assets/cargohold.js index 18dbeae..2a4ca76 100644 --- a/assets/cargohold.js +++ b/assets/cargohold.js @@ -7,7 +7,6 @@ var running = false; var queue = []; - function queue_work(){ let i = 0; for(; i < queue.length; i++){ @@ -118,6 +117,7 @@ function interface_update(access){ function listing_add(file, style = "default"){ let link = node("a", "listing-entry", file.name); link.href = "file/" + encodeURIComponent(file.name); + link.setAttribute("data-filename", file.name) if(style == "gallery"){ let image = node("img", "preview"); @@ -144,9 +144,27 @@ function listing_update(){ req.send(); } +function download_all(ev){ + let links = document.getElementsByClassName("listing-entry"); + var current = 0; + var interval = setInterval(function(){ + if(current < links.length){ + link = links[current]; + link.download = link.getAttribute("data-filename"); + link.click(); + link.removeAttribute("download"); + current++; + } + else{ + clearInterval(interval); + } + }, 1000); +} + function init(){ element("file-submit").style.display = "none"; element("files").onchange = upload_start; + element("download-all").onclick = download_all; listing_update(); } |