aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--assets/admin.css9
-rw-r--r--assets/cargohold.css20
-rw-r--r--assets/cargohold.js20
-rw-r--r--interface/listing.htm3
5 files changed, 43 insertions, 12 deletions
diff --git a/TODO b/TODO
index d0db819..720eef0 100644
--- a/TODO
+++ b/TODO
@@ -2,12 +2,13 @@ Size limiting
HTML-only frontend
Automatic resizing for gallery mode
Alias titles
-'Download all' button
Password protection per alias
'Scramble' file links (do not make the parent directory available via the individual links)
Admin
Size limit administration
+ Add aliases
+ Add specific aliases?
JS Admin
Rename
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();
}
diff --git a/interface/listing.htm b/interface/listing.htm
index 7cc2b62..d7d08cd 100644
--- a/interface/listing.htm
+++ b/interface/listing.htm
@@ -30,6 +30,9 @@
current link.
</div>
</noscript>
+ <div class="buttonrow">
+ <a class="button" href="#" id="download-all">Download all</a>
+ </div>
<div id="dirlisting">
</div>
</div>