summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-09-30 01:05:24 +0500
committerilotterytea <iltsu@alright.party>2025-09-30 01:05:24 +0500
commit21c125471b96176bbee0ea8cb8e3ef3b708eb7eb (patch)
treeb0518ac2a7c5f8b855b157283c924960681a4a9a /public
parent4ce56e9cb070c08edc5abab629b78c7634a16c39 (diff)
fix: uploaded file section doesn't appear after the first upload
Diffstat (limited to 'public')
-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");