From f5e8ace1dd7694cb6f426dc1b3666c11f4e71e78 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 8 Jun 2025 03:14:14 +0400 Subject: feat: a button to delete file locally --- public/index.php | 13 ++++++++++--- public/static/img/icons/cross.png | Bin 0 -> 655 bytes public/static/style.css | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100755 public/static/img/icons/cross.png diff --git a/public/index.php b/public/index.php index 6f58fe8..393940d 100644 --- a/public/index.php +++ b/public/index.php @@ -511,6 +511,9 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); return `
+
@@ -546,9 +549,7 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); return; } - let files = getUploadedFiles(); - files = files.filter((x) => x.id !== id); - localStorage.setItem('uploaded_files', JSON.stringify(files)); + deleteFileLocally(id); loadUploadedFiles(); }) .catch((err) => { @@ -557,6 +558,12 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); }); } + function deleteFileLocally(id) { + let files = getUploadedFiles(); + files = files.filter((x) => x.id !== id); + localStorage.setItem('uploaded_files', JSON.stringify(files)); + } + // loading already existing uploaded files function loadUploadedFiles() { let files = getUploadedFiles(); diff --git a/public/static/img/icons/cross.png b/public/static/img/icons/cross.png new file mode 100755 index 0000000..1514d51 Binary files /dev/null and b/public/static/img/icons/cross.png differ diff --git a/public/static/style.css b/public/static/style.css index 1eb29dc..c5302c8 100644 --- a/public/static/style.css +++ b/public/static/style.css @@ -242,6 +242,11 @@ button[type=submit]:hover { overflow-x: scroll; } +.item .delete-btn { + position: absolute; + align-self: flex-end; +} + /** SHORTCUTS */ .column { display: flex; -- cgit v1.2.3