diff --git a/index.js b/index.js index c15b72a8..59dc37a5 100644 --- a/index.js +++ b/index.js @@ -196,12 +196,39 @@ async function handleDefaultPath(url, request) { font-style: italic; color: #666; } + .file-actions { + display: flex; + gap: 10px; + } + .delete-btn { + color: #ff4444; + cursor: pointer; + background: none; + border: none; + padding: 5px; + } + .delete-btn:hover { + color: #ff0000; + } + .clear-all-btn { + background-color: #ff4444; + color: white; + border: none; + padding: 10px 15px; + border-radius: 4px; + cursor: pointer; + margin-bottom: 20px; + } + .clear-all-btn:hover { + background-color: #ff0000; + }

Cloud Drive

Welcome to your personal cloud storage. Here are your uploaded files:

+
@@ -217,13 +244,35 @@ async function handleDefaultPath(url, request) { const fileList = document.getElementById('fileList'); const savedFiles = JSON.parse(localStorage.getItem('uploadedFiles')) || []; fileList.innerHTML = ''; - savedFiles.forEach(file => { + savedFiles.forEach((file, index) => { const li = document.createElement('li'); - li.innerHTML = \`📄\${file.Name}\`; + li.innerHTML = \` + 📄 + \${file.Name} +
+ +
+ \`; fileList.appendChild(li); }); } + function deleteFile(index) { + const savedFiles = JSON.parse(localStorage.getItem('uploadedFiles')) || []; + savedFiles.splice(index, 1); + localStorage.setItem('uploadedFiles', JSON.stringify(savedFiles)); + loadFileList(); + } + + document.getElementById('clearAllBtn').addEventListener('click', () => { + if (confirm('Are you sure you want to clear all files?')) { + localStorage.removeItem('uploadedFiles'); + loadFileList(); + } + }); + loadFileList(); const uploadArea = document.getElementById('uploadArea');