From c00f4af397e596f85a24b07bdab0cf73c019004a Mon Sep 17 00:00:00 2001 From: Booteille Date: Thu, 5 Dec 2024 11:33:23 +0100 Subject: [PATCH] Hide compression options when uploading only one file --- themes/default/public/js/upload.js | 14 ++++++++++++++ themes/default/templates/index.html.ep | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/themes/default/public/js/upload.js b/themes/default/public/js/upload.js index 78ced4c..9cf927b 100644 --- a/themes/default/public/js/upload.js +++ b/themes/default/public/js/upload.js @@ -368,6 +368,14 @@ document.addEventListener("DOMContentLoaded", () => { document.querySelector(".total-size .size").innerText = filesize(totalSize); + if (providedFiles.length > 1) { + document + .getElementById("zip-fields") + .classList.remove("is-hidden"); + } else { + document.getElementById("zip-fields").classList.add("is-hidden"); + } + if (providedFiles.length === 0) { document .getElementById("upload-controls") @@ -393,6 +401,12 @@ document.addEventListener("DOMContentLoaded", () => { showSmallUploadZone(); }); + + if (providedFiles.length > 1) { + document.getElementById("zip-fields").classList.remove("is-hidden"); + } else { + document.getElementById("zip-fields").classList.add("is-hidden"); + } }; document.getElementById("zip-multiple").onchange = () => { diff --git a/themes/default/templates/index.html.ep b/themes/default/templates/index.html.ep index 918a313..682e7f2 100644 --- a/themes/default/templates/index.html.ep +++ b/themes/default/templates/index.html.ep @@ -132,7 +132,7 @@ -
+