diff --git a/delete.php b/delete.php new file mode 100644 index 0000000..28ff122 --- /dev/null +++ b/delete.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/index.php b/index.php index a5dacb8..67e2444 100644 --- a/index.php +++ b/index.php @@ -103,7 +103,7 @@ $filesize = number_format($filesize, 2, ",", " ") . $msr; } - echo "\n"; } echo "
\n"; - echo "
\n"; } else { if ($ext == "mp4") { echo "📼"; @@ -142,8 +141,9 @@ if ($clr == " list-group-item-warning") { echo "
\n"; } - echo "\n"; } + echo "🗑"; + echo "\n"; } } closedir($dh); diff --git a/main.js b/main.js index 0e6b2c8..6cd0ffd 100644 --- a/main.js +++ b/main.js @@ -1,3 +1,17 @@ $(document).on('click', 'div.dropdown-menu', function (e) { e.stopPropagation(); +}); + +const buttons = document.querySelectorAll('.delete-button') +buttons.forEach((button) => { + button.addEventListener("click", async function(event) { + const response = await fetch("delete.php", { + method: 'POST', + headers: { + 'Accept': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body: `file=${event.target.dataset.file}` + }); + }) }); \ No newline at end of file