Add 2 files
Browse files- README.md +7 -5
- index.html +457 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: try1
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,457 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>SwiftShare | Simple & Fast File Sharing</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Poppins', sans-serif;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.drop-zone {
|
| 17 |
+
border: 2px dashed #3b82f6;
|
| 18 |
+
transition: all 0.3s;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.drop-zone--over {
|
| 22 |
+
border-color: #10b981;
|
| 23 |
+
background-color: rgba(16, 185, 129, 0.05);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
.file-item {
|
| 27 |
+
transition: all 0.2s;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.file-item:hover {
|
| 31 |
+
transform: translateY(-2px);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.progress-bar {
|
| 35 |
+
height: 6px;
|
| 36 |
+
transition: width 0.3s;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.toast {
|
| 40 |
+
animation: slideIn 0.3s, fadeOut 0.5s 2.5s forwards;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
@keyframes slideIn {
|
| 44 |
+
from { transform: translateX(100%); opacity: 0; }
|
| 45 |
+
to { transform: translateX(0); opacity: 1; }
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
@keyframes fadeOut {
|
| 49 |
+
to { opacity: 0; }
|
| 50 |
+
}
|
| 51 |
+
</style>
|
| 52 |
+
</head>
|
| 53 |
+
<body class="bg-gray-50 min-h-screen">
|
| 54 |
+
<!-- Header -->
|
| 55 |
+
<header class="bg-white shadow-sm">
|
| 56 |
+
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
|
| 57 |
+
<div class="flex items-center space-x-2">
|
| 58 |
+
<i class="fas fa-paperclip text-blue-500 text-2xl"></i>
|
| 59 |
+
<h1 class="text-2xl font-bold text-gray-800">SwiftShare</h1>
|
| 60 |
+
</div>
|
| 61 |
+
<nav>
|
| 62 |
+
<ul class="flex space-x-6">
|
| 63 |
+
<li><a href="#" class="text-gray-600 hover:text-blue-500 transition">Home</a></li>
|
| 64 |
+
<li><a href="#" class="text-gray-600 hover:text-blue-500 transition">Features</a></li>
|
| 65 |
+
<li><a href="#" class="text-gray-600 hover:text-blue-500 transition">Pricing</a></li>
|
| 66 |
+
<li><a href="#" class="text-gray-600 hover:text-blue-500 transition">About</a></li>
|
| 67 |
+
</ul>
|
| 68 |
+
</nav>
|
| 69 |
+
<div class="flex space-x-4">
|
| 70 |
+
<button class="px-4 py-2 text-blue-500 font-medium rounded-lg hover:bg-blue-50 transition">Login</button>
|
| 71 |
+
<button class="px-4 py-2 bg-blue-500 text-white font-medium rounded-lg hover:bg-blue-600 transition">Sign Up</button>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
</header>
|
| 75 |
+
|
| 76 |
+
<!-- Main Content -->
|
| 77 |
+
<main class="container mx-auto px-4 py-12">
|
| 78 |
+
<div class="max-w-4xl mx-auto text-center mb-12">
|
| 79 |
+
<h2 class="text-4xl font-bold text-gray-800 mb-4">Share Files Fast & Easy</h2>
|
| 80 |
+
<p class="text-xl text-gray-600 max-w-2xl mx-auto">Upload your files and share them with anyone via link. No registration required.</p>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<!-- Upload Section -->
|
| 84 |
+
<div class="max-w-3xl mx-auto bg-white rounded-xl shadow-lg p-8 mb-12">
|
| 85 |
+
<div id="drop-zone" class="drop-zone border-2 rounded-xl p-12 text-center cursor-pointer transition-colors">
|
| 86 |
+
<div id="upload-content" class="space-y-4">
|
| 87 |
+
<div class="flex justify-center">
|
| 88 |
+
<div class="bg-blue-100 p-4 rounded-full">
|
| 89 |
+
<i class="fas fa-cloud-upload-alt text-blue-500 text-3xl"></i>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
<h3 class="text-xl font-semibold text-gray-800">Drag & Drop Files Here</h3>
|
| 93 |
+
<p class="text-gray-500">or</p>
|
| 94 |
+
<button id="select-files-btn" class="px-6 py-3 bg-blue-500 text-white font-medium rounded-lg hover:bg-blue-600 transition">
|
| 95 |
+
Select Files
|
| 96 |
+
</button>
|
| 97 |
+
<p class="text-sm text-gray-500 mt-6">Supports: images, documents, videos, audio files (Max: 10MB)</p>
|
| 98 |
+
<input type="file" id="file-input" class="hidden" multiple>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<div id="upload-progress" class="hidden space-y-6">
|
| 102 |
+
<h3 class="text-xl font-semibold text-gray-800">Uploading Files</h3>
|
| 103 |
+
<div id="file-list" class="space-y-4"></div>
|
| 104 |
+
<div class="flex justify-center">
|
| 105 |
+
<button id="cancel-upload-btn" class="px-6 py-3 bg-red-500 text-white font-medium rounded-lg hover:bg-red-600 transition">
|
| 106 |
+
Cancel Upload
|
| 107 |
+
</button>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
|
| 113 |
+
<!-- How It Works Section -->
|
| 114 |
+
<div class="max-w-6xl mx-auto">
|
| 115 |
+
<h2 class="text-3xl font-bold text-center text-gray-800 mb-12">How It Works</h2>
|
| 116 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 117 |
+
<div class="bg-white p-6 rounded-xl shadow-md text-center">
|
| 118 |
+
<div class="bg-blue-100 inline-flex p-4 rounded-full mb-4">
|
| 119 |
+
<i class="fas fa-upload text-blue-500 text-2xl"></i>
|
| 120 |
+
</div>
|
| 121 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-2">1. Upload Files</h3>
|
| 122 |
+
<p class="text-gray-600">Drag & drop your files or click to browse your computer.</p>
|
| 123 |
+
</div>
|
| 124 |
+
<div class="bg-white p-6 rounded-xl shadow-md text-center">
|
| 125 |
+
<div class="bg-blue-100 inline-flex p-4 rounded-full mb-4">
|
| 126 |
+
<i class="fas fa-link text-blue-500 text-2xl"></i>
|
| 127 |
+
</div>
|
| 128 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-2">2. Get Shareable Link</h3>
|
| 129 |
+
<p class="text-gray-600">Instantly receive a unique link to share with anyone.</p>
|
| 130 |
+
</div>
|
| 131 |
+
<div class="bg-white p-6 rounded-xl shadow-md text-center">
|
| 132 |
+
<div class="bg-blue-100 inline-flex p-4 rounded-full mb-4">
|
| 133 |
+
<i class="fas fa-share-alt text-blue-500 text-2xl"></i>
|
| 134 |
+
</div>
|
| 135 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-2">3. Share & Track</h3>
|
| 136 |
+
<p class="text-gray-600">Send the link via email, message, or social media.</p>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<!-- Recent Uploads Section (Would be dynamic in a real app) -->
|
| 142 |
+
<div id="recent-uploads" class="max-w-6xl mx-auto mt-16 hidden">
|
| 143 |
+
<div class="flex justify-between items-center mb-6">
|
| 144 |
+
<h2 class="text-2xl font-bold text-gray-800">Recent Uploads</h2>
|
| 145 |
+
<button class="text-blue-500 hover:text-blue-700">Clear All</button>
|
| 146 |
+
</div>
|
| 147 |
+
<div id="recent-files" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"></div>
|
| 148 |
+
</div>
|
| 149 |
+
</main>
|
| 150 |
+
|
| 151 |
+
<!-- Toast Notification -->
|
| 152 |
+
<div id="toast" class="fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg hidden toast">
|
| 153 |
+
<div class="flex items-center space-x-3">
|
| 154 |
+
<i class="fas fa-check-circle"></i>
|
| 155 |
+
<span id="toast-message">File uploaded successfully!</span>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
|
| 159 |
+
<!-- Footer -->
|
| 160 |
+
<footer class="bg-gray-800 text-white py-12">
|
| 161 |
+
<div class="container mx-auto px-4">
|
| 162 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 163 |
+
<div>
|
| 164 |
+
<h3 class="text-xl font-bold mb-4">SwiftShare</h3>
|
| 165 |
+
<p class="text-gray-400">Fast, simple and secure file sharing for everyone.</p>
|
| 166 |
+
</div>
|
| 167 |
+
<div>
|
| 168 |
+
<h4 class="font-semibold mb-4">Product</h4>
|
| 169 |
+
<ul class="space-y-2">
|
| 170 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Features</a></li>
|
| 171 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Pricing</a></li>
|
| 172 |
+
<li><a href="#" class="text-gray-400 hover:text-white">API</a></li>
|
| 173 |
+
</ul>
|
| 174 |
+
</div>
|
| 175 |
+
<div>
|
| 176 |
+
<h4 class="font-semibold mb-4">Company</h4>
|
| 177 |
+
<ul class="space-y-2">
|
| 178 |
+
<li><a href="#" class="text-gray-400 hover:text-white">About</a></li>
|
| 179 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li>
|
| 180 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li>
|
| 181 |
+
</ul>
|
| 182 |
+
</div>
|
| 183 |
+
<div>
|
| 184 |
+
<h4 class="font-semibold mb-4">Support</h4>
|
| 185 |
+
<ul class="space-y-2">
|
| 186 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Help Center</a></li>
|
| 187 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Contact Us</a></li>
|
| 188 |
+
<li><a href="#" class="text-gray-400 hover:text-white">Status</a></li>
|
| 189 |
+
</ul>
|
| 190 |
+
</div>
|
| 191 |
+
</div>
|
| 192 |
+
<div class="border-t border-gray-700 mt-8 pt-8 flex flex-col md:flex-row justify-between items-center">
|
| 193 |
+
<p class="text-gray-400">© 2023 SwiftShare. All rights reserved.</p>
|
| 194 |
+
<div class="flex space-x-6 mt-4 md:mt-0">
|
| 195 |
+
<a href="#"><i class="fab fa-twitter text-gray-400 hover:text-white"></i></a>
|
| 196 |
+
<a href="#"><i class="fab fa-facebook text-gray-400 hover:text-white"></i></a>
|
| 197 |
+
<a href="#"><i class="fab fa-instagram text-gray-400 hover:text-white"></i></a>
|
| 198 |
+
<a href="#"><i class="fab fa-linkedin text-gray-400 hover:text-white"></i></a>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
</div>
|
| 202 |
+
</footer>
|
| 203 |
+
|
| 204 |
+
<script>
|
| 205 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 206 |
+
const dropZone = document.getElementById('drop-zone');
|
| 207 |
+
const uploadContent = document.getElementById('upload-content');
|
| 208 |
+
const uploadProgress = document.getElementById('upload-progress');
|
| 209 |
+
const selectFilesBtn = document.getElementById('select-files-btn');
|
| 210 |
+
const fileInput = document.getElementById('file-input');
|
| 211 |
+
const fileList = document.getElementById('file-list');
|
| 212 |
+
const cancelUploadBtn = document.getElementById('cancel-upload-btn');
|
| 213 |
+
const recentUploads = document.getElementById('recent-uploads');
|
| 214 |
+
const recentFiles = document.getElementById('recent-files');
|
| 215 |
+
const toast = document.getElementById('toast');
|
| 216 |
+
const toastMessage = document.getElementById('toast-message');
|
| 217 |
+
|
| 218 |
+
let uploadsInProgress = [];
|
| 219 |
+
|
| 220 |
+
// Prevent default drag behaviors
|
| 221 |
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
| 222 |
+
dropZone.addEventListener(eventName, preventDefaults, false);
|
| 223 |
+
document.body.addEventListener(eventName, preventDefaults, false);
|
| 224 |
+
});
|
| 225 |
+
|
| 226 |
+
// Highlight drop zone when item is dragged over it
|
| 227 |
+
['dragenter', 'dragover'].forEach(eventName => {
|
| 228 |
+
dropZone.addEventListener(eventName, highlight, false);
|
| 229 |
+
});
|
| 230 |
+
|
| 231 |
+
['dragleave', 'drop'].forEach(eventName => {
|
| 232 |
+
dropZone.addEventListener(eventName, unhighlight, false);
|
| 233 |
+
});
|
| 234 |
+
|
| 235 |
+
// Handle dropped files
|
| 236 |
+
dropZone.addEventListener('drop', handleDrop, false);
|
| 237 |
+
|
| 238 |
+
// Handle selected files
|
| 239 |
+
selectFilesBtn.addEventListener('click', () => fileInput.click());
|
| 240 |
+
fileInput.addEventListener('change', handleFiles);
|
| 241 |
+
|
| 242 |
+
// Cancel upload
|
| 243 |
+
cancelUploadBtn.addEventListener('click', cancelUpload);
|
| 244 |
+
|
| 245 |
+
function preventDefaults(e) {
|
| 246 |
+
e.preventDefault();
|
| 247 |
+
e.stopPropagation();
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
function highlight() {
|
| 251 |
+
dropZone.classList.add('drop-zone--over');
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
function unhighlight() {
|
| 255 |
+
dropZone.classList.remove('drop-zone--over');
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
function handleDrop(e) {
|
| 259 |
+
const dt = e.dataTransfer;
|
| 260 |
+
const files = dt.files;
|
| 261 |
+
handleFiles({ target: { files } });
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
function handleFiles(e) {
|
| 265 |
+
const files = e.target.files;
|
| 266 |
+
if (files.length === 0) return;
|
| 267 |
+
|
| 268 |
+
uploadContent.classList.add('hidden');
|
| 269 |
+
uploadProgress.classList.remove('hidden');
|
| 270 |
+
fileList.innerHTML = '';
|
| 271 |
+
|
| 272 |
+
[...files].forEach(file => {
|
| 273 |
+
if (file.size > 10 * 1024 * 1024) {
|
| 274 |
+
showToast('File too large (max 10MB)', 'error');
|
| 275 |
+
return;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
const fileId = `file-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
| 279 |
+
const fileItem = createFileItem(file, fileId);
|
| 280 |
+
fileList.appendChild(fileItem);
|
| 281 |
+
|
| 282 |
+
// Simulate upload progress
|
| 283 |
+
const upload = {
|
| 284 |
+
id: fileId,
|
| 285 |
+
file: file,
|
| 286 |
+
progress: 0,
|
| 287 |
+
interval: null
|
| 288 |
+
};
|
| 289 |
+
|
| 290 |
+
upload.interval = setInterval(() => {
|
| 291 |
+
if (upload.progress >= 100) {
|
| 292 |
+
clearInterval(upload.interval);
|
| 293 |
+
// Show success state
|
| 294 |
+
document.getElementById(`progress-${fileId}`).classList.remove('bg-blue-500');
|
| 295 |
+
document.getElementById(`progress-${fileId}`).classList.add('bg-green-500');
|
| 296 |
+
document.getElementById(`status-${fileId}`).innerHTML = '<i class="fas fa-check-circle text-green-500"></i> Uploaded';
|
| 297 |
+
|
| 298 |
+
// Add to recent uploads
|
| 299 |
+
addToRecentUploads(file, fileId);
|
| 300 |
+
showToast(`${file.name} uploaded successfully!`, 'success');
|
| 301 |
+
} else {
|
| 302 |
+
upload.progress += Math.random() * 10 + 5;
|
| 303 |
+
if (upload.progress > 100) upload.progress = 100;
|
| 304 |
+
document.getElementById(`progress-${fileId}`).style.width = `${upload.progress}%`;
|
| 305 |
+
}
|
| 306 |
+
}, 300 + Math.random() * 300);
|
| 307 |
+
|
| 308 |
+
uploadsInProgress.push(upload);
|
| 309 |
+
});
|
| 310 |
+
|
| 311 |
+
fileInput.value = '';
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
function createFileItem(file, fileId) {
|
| 315 |
+
const fileItem = document.createElement('div');
|
| 316 |
+
fileItem.className = 'file-item bg-gray-50 rounded-lg p-4 flex justify-between items-center';
|
| 317 |
+
|
| 318 |
+
const fileInfo = document.createElement('div');
|
| 319 |
+
fileInfo.className = 'flex items-center space-x-3';
|
| 320 |
+
|
| 321 |
+
// File icon based on type
|
| 322 |
+
let iconClass = 'fas fa-file';
|
| 323 |
+
if (file.type.startsWith('image/')) iconClass = 'fas fa-file-image';
|
| 324 |
+
else if (file.type.startsWith('video/')) iconClass = 'fas fa-file-video';
|
| 325 |
+
else if (file.type.startsWith('audio/')) iconClass = 'fas fa-file-audio';
|
| 326 |
+
else if (file.type === 'application/pdf') iconClass = 'fas fa-file-pdf';
|
| 327 |
+
else if (file.type.startsWith('application/msword') || file.type.includes('wordprocessingml')) iconClass = 'fas fa-file-word';
|
| 328 |
+
else if (file.type.startsWith('application/vnd.ms-excel') || file.type.includes('spreadsheetml')) iconClass = 'fas fa-file-excel';
|
| 329 |
+
else if (file.type.startsWith('application/vnd.ms-powerpoint') || file.type.includes('presentationml')) iconClass = 'fas fa-file-powerpoint';
|
| 330 |
+
|
| 331 |
+
fileInfo.innerHTML = `
|
| 332 |
+
<div class="bg-blue-100 p-2 rounded-lg">
|
| 333 |
+
<i class="${iconClass} text-blue-500"></i>
|
| 334 |
+
</div>
|
| 335 |
+
<div>
|
| 336 |
+
<p class="font-medium text-gray-800 truncate max-w-xs">${file.name}</p>
|
| 337 |
+
<p class="text-xs text-gray-500">${formatFileSize(file.size)}</p>
|
| 338 |
+
</div>
|
| 339 |
+
`;
|
| 340 |
+
|
| 341 |
+
const uploadStatus = document.createElement('div');
|
| 342 |
+
uploadStatus.className = 'text-right';
|
| 343 |
+
uploadStatus.id = `status-${fileId}`;
|
| 344 |
+
uploadStatus.innerHTML = 'Uploading...';
|
| 345 |
+
|
| 346 |
+
fileItem.appendChild(fileInfo);
|
| 347 |
+
fileItem.appendChild(uploadStatus);
|
| 348 |
+
|
| 349 |
+
const progressContainer = document.createElement('div');
|
| 350 |
+
progressContainer.className = 'w-full mt-2';
|
| 351 |
+
|
| 352 |
+
const progressBar = document.createElement('div');
|
| 353 |
+
progressBar.className = 'progress-bar bg-blue-500 rounded-full';
|
| 354 |
+
progressBar.id = `progress-${fileId}`;
|
| 355 |
+
progressBar.style.width = '0%';
|
| 356 |
+
|
| 357 |
+
progressContainer.appendChild(progressBar);
|
| 358 |
+
|
| 359 |
+
const container = document.createElement('div');
|
| 360 |
+
container.className = 'w-full';
|
| 361 |
+
container.appendChild(fileItem);
|
| 362 |
+
container.appendChild(progressContainer);
|
| 363 |
+
|
| 364 |
+
return container;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
function addToRecentUploads(file, fileId) {
|
| 368 |
+
recentUploads.classList.remove('hidden');
|
| 369 |
+
|
| 370 |
+
const fileItem = document.createElement('div');
|
| 371 |
+
fileItem.className = 'bg-white rounded-lg shadow-sm hover:shadow-md transition-shadow p-4';
|
| 372 |
+
|
| 373 |
+
let iconClass = 'fas fa-file';
|
| 374 |
+
if (file.type.startsWith('image/')) iconClass = 'fas fa-file-image';
|
| 375 |
+
else if (file.type.startsWith('video/')) iconClass = 'fas fa-file-video';
|
| 376 |
+
else if (file.type.startsWith('audio/')) iconClass = 'fas fa-file-audio';
|
| 377 |
+
else if (file.type === 'application/pdf') iconClass = 'fas fa-file-pdf';
|
| 378 |
+
else if (file.type.startsWith('application/msword') || file.type.includes('wordprocessingml')) iconClass = 'fas fa-file-word';
|
| 379 |
+
else if (file.type.startsWith('application/vnd.ms-excel') || file.type.includes('spreadsheetml')) iconClass = 'fas fa-file-excel';
|
| 380 |
+
else if (file.type.startsWith('application/vnd.ms-powerpoint') || file.type.includes('presentationml')) iconClass = 'fas fa-file-powerpoint';
|
| 381 |
+
|
| 382 |
+
fileItem.innerHTML = `
|
| 383 |
+
<div class="flex items-center space-x-3 mb-3">
|
| 384 |
+
<div class="bg-blue-100 p-2 rounded-lg">
|
| 385 |
+
<i class="${iconClass} text-blue-500"></i>
|
| 386 |
+
</div>
|
| 387 |
+
<div class="flex-1 min-w-0">
|
| 388 |
+
<p class="font-medium text-gray-800 truncate">${file.name}</p>
|
| 389 |
+
<p class="text-xs text-gray-500">${formatFileSize(file.size)}</p>
|
| 390 |
+
</div>
|
| 391 |
+
</div>
|
| 392 |
+
<div class="flex justify-between items-center">
|
| 393 |
+
<button class="px-3 py-1 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 transition">
|
| 394 |
+
<i class="fas fa-link mr-1"></i> Copy Link
|
| 395 |
+
</button>
|
| 396 |
+
<span class="text-xs text-gray-500">Just now</span>
|
| 397 |
+
</div>
|
| 398 |
+
`;
|
| 399 |
+
|
| 400 |
+
recentFiles.prepend(fileItem);
|
| 401 |
+
|
| 402 |
+
// Simulate share link functionality
|
| 403 |
+
const copyBtn = fileItem.querySelector('button');
|
| 404 |
+
copyBtn.addEventListener('click', () => {
|
| 405 |
+
navigator.clipboard.writeText(`https://swiftshare.com/${fileId}`);
|
| 406 |
+
copyBtn.innerHTML = '<i class="fas fa-check mr-1"></i> Copied!';
|
| 407 |
+
setTimeout(() => {
|
| 408 |
+
copyBtn.innerHTML = '<i class="fas fa-link mr-1"></i> Copy Link';
|
| 409 |
+
}, 2000);
|
| 410 |
+
});
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
function cancelUpload() {
|
| 414 |
+
uploadsInProgress.forEach(upload => {
|
| 415 |
+
clearInterval(upload.interval);
|
| 416 |
+
document.getElementById(`progress-${upload.id}`).classList.remove('bg-blue-500');
|
| 417 |
+
document.getElementById(`progress-${upload.id}`).classList.add('bg-gray-500');
|
| 418 |
+
document.getElementById(`status-${upload.id}`).innerHTML = '<i class="fas fa-times-circle text-gray-500"></i> Cancelled';
|
| 419 |
+
});
|
| 420 |
+
|
| 421 |
+
uploadsInProgress = [];
|
| 422 |
+
|
| 423 |
+
setTimeout(() => {
|
| 424 |
+
uploadProgress.classList.add('hidden');
|
| 425 |
+
uploadContent.classList.remove('hidden');
|
| 426 |
+
}, 1000);
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
function showToast(message, type = 'success') {
|
| 430 |
+
toastMessage.textContent = message;
|
| 431 |
+
|
| 432 |
+
if (type === 'error') {
|
| 433 |
+
toast.classList.remove('bg-green-500');
|
| 434 |
+
toast.classList.add('bg-red-500');
|
| 435 |
+
} else {
|
| 436 |
+
toast.classList.remove('bg-red-500');
|
| 437 |
+
toast.classList.add('bg-green-500');
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
toast.classList.remove('hidden');
|
| 441 |
+
|
| 442 |
+
setTimeout(() => {
|
| 443 |
+
toast.classList.add('hidden');
|
| 444 |
+
}, 3000);
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
function formatFileSize(bytes) {
|
| 448 |
+
if (bytes === 0) return '0 Bytes';
|
| 449 |
+
const k = 1024;
|
| 450 |
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
| 451 |
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
| 452 |
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
| 453 |
+
}
|
| 454 |
+
});
|
| 455 |
+
</script>
|
| 456 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=z0m80z/try1" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
|
| 457 |
+
</html>
|