summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/index.php16
-rw-r--r--public/static/scripts/upload.js4
2 files changed, 19 insertions, 1 deletions
diff --git a/public/index.php b/public/index.php
index e64dd65..735f49d 100644
--- a/public/index.php
+++ b/public/index.php
@@ -555,6 +555,8 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt');
showFile(null);
fileUploadWrapper.style.display = 'block';
fileURL.value = '';
+
+ document.querySelector('#uploaded-files').parentElement.style.display = 'grid';
});
const fileURLWrapper = document.querySelector('#form-upload-wrapper>div');
@@ -609,7 +611,19 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt');
});
setFormDetailsVisiblity(false);
- displayTab('file-tabs', 'uploaded-files');
+ const uploadedFileCount = getUploadedFiles().length;
+ const favoriteFileCount = getFavoriteFiles().length;
+ if (uploadedFileCount > 0) {
+ document.querySelector('#uploaded-files').parentElement.style.display = 'grid';
+ displayTab('file-tabs', 'uploaded-files');
+ }
+
+ if (favoriteFileCount > 0) {
+ document.querySelector('#favorite-files').parentElement.style.display = 'grid';
+ if (uploadedFileCount == 0) {
+ displayTab('file-tabs', 'favorite-files');
+ }
+ }
</script>
<?php endif; ?>
diff --git a/public/static/scripts/upload.js b/public/static/scripts/upload.js
index 226257d..72b8ef5 100644
--- a/public/static/scripts/upload.js
+++ b/public/static/scripts/upload.js
@@ -67,6 +67,10 @@ function createUploadedFileItem(data) {
const btn = document.createElement("button");
btn.addEventListener("click", () => {
deleteUploadedFile(data.urls.deletion_url, data.id);
+ base.remove();
+ if (getUploadedFiles().length == 0) {
+ document.querySelector('#uploaded-files').parentElement.style.display = 'none';
+ }
});
const img = document.createElement("img");