Spaces:
Running
Running
create the web site from the beginning
Browse files- index.html +18 -11
index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Swiss Army Web Tools 🛠️</title>
|
| 7 |
-
<link rel="icon" type="image/x-icon" href="
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
@@ -53,7 +53,7 @@
|
|
| 53 |
<button class="tab-btn px-6 py-3 font-medium text-gray-500 hover:text-indigo-600" data-tab="shortener">Link Shortener</button>
|
| 54 |
<button class="tab-btn px-6 py-3 font-medium text-gray-500 hover:text-indigo-600" data-tab="bgremover">BG Remover</button>
|
| 55 |
<button class="tab-btn px-6 py-3 font-medium text-gray-500 hover:text-indigo-600" data-tab="password">Password Gen</button>
|
| 56 |
-
</div>
|
| 57 |
|
| 58 |
<div class="p-6">
|
| 59 |
<!-- QR Code Generator -->
|
|
@@ -82,6 +82,7 @@
|
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
<p class="text-sm text-gray-500">Scan the QR code with your phone</p>
|
|
|
|
| 85 |
</div>
|
| 86 |
</div>
|
| 87 |
|
|
@@ -152,8 +153,8 @@
|
|
| 152 |
</div>
|
| 153 |
</div>
|
| 154 |
</div>
|
| 155 |
-
|
| 156 |
-
<!-- Text Counter -->
|
| 157 |
<div id="counter" class="tab-content">
|
| 158 |
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Text & Character Counter</h2>
|
| 159 |
<div class="mb-4">
|
|
@@ -196,9 +197,10 @@
|
|
| 196 |
</div>
|
| 197 |
</div>
|
| 198 |
</div>
|
|
|
|
| 199 |
<!-- Background Remover -->
|
| 200 |
<div id="bgremover" class="tab-content">
|
| 201 |
-
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Background Remover</h2>
|
| 202 |
<div class="mb-4">
|
| 203 |
<label for="imageUpload" class="block text-gray-700 mb-2">Upload image</label>
|
| 204 |
<div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center cursor-pointer hover:border-indigo-400 transition" id="dropZone">
|
|
@@ -241,6 +243,7 @@
|
|
| 241 |
<p>Made with <i data-feather="heart" class="inline text-red-500 w-4 h-4"></i> for the web</p>
|
| 242 |
</footer>
|
| 243 |
</div>
|
|
|
|
| 244 |
<script>
|
| 245 |
// Tab switching
|
| 246 |
document.querySelectorAll('.tab-btn').forEach(btn => {
|
|
@@ -266,8 +269,7 @@
|
|
| 266 |
});
|
| 267 |
});
|
| 268 |
|
| 269 |
-
|
| 270 |
-
// QR Code Generator
|
| 271 |
document.getElementById('generateQR').addEventListener('click', () => {
|
| 272 |
const text = document.getElementById('qrText').value.trim();
|
| 273 |
if (!text) {
|
|
@@ -312,6 +314,7 @@
|
|
| 312 |
const sentences = text.trim() ? text.split(/[.!?]+/).filter(s => s.trim().length > 0).length : 0;
|
| 313 |
document.getElementById('sentenceCount').textContent = sentences;
|
| 314 |
});
|
|
|
|
| 315 |
// Link Shortener with Rebrandly API
|
| 316 |
document.getElementById('shortenBtn').addEventListener('click', async () => {
|
| 317 |
const longUrl = document.getElementById('longUrl').value.trim();
|
|
@@ -345,7 +348,8 @@
|
|
| 345 |
alert('Failed to shorten URL. Please try again later.');
|
| 346 |
}
|
| 347 |
});
|
| 348 |
-
|
|
|
|
| 349 |
const shortUrl = document.getElementById('shortUrl');
|
| 350 |
shortUrl.select();
|
| 351 |
document.execCommand('copy');
|
|
@@ -359,8 +363,9 @@ document.getElementById('copyShortUrl').addEventListener('click', () => {
|
|
| 359 |
feather.replace();
|
| 360 |
}, 2000);
|
| 361 |
});
|
|
|
|
| 362 |
// Background Remover with remove.bg API
|
| 363 |
-
const dropZone = document.getElementById('dropZone');
|
| 364 |
const fileInput = document.getElementById('imageUpload');
|
| 365 |
|
| 366 |
dropZone.addEventListener('click', () => fileInput.click());
|
|
@@ -410,6 +415,7 @@ const dropZone = document.getElementById('dropZone');
|
|
| 410 |
};
|
| 411 |
reader.readAsDataURL(file);
|
| 412 |
}
|
|
|
|
| 413 |
document.getElementById('removeBgBtn').addEventListener('click', async () => {
|
| 414 |
const preview = document.getElementById('bgRemoverPreview');
|
| 415 |
const originalImg = document.getElementById('originalImage');
|
|
@@ -449,6 +455,7 @@ const dropZone = document.getElementById('dropZone');
|
|
| 449 |
link.href = processedImg.src;
|
| 450 |
link.click();
|
| 451 |
});
|
|
|
|
| 452 |
// Password Generator
|
| 453 |
document.getElementById('passwordLength').addEventListener('input', function() {
|
| 454 |
document.getElementById('lengthValue').textContent = this.value;
|
|
@@ -550,6 +557,6 @@ const dropZone = document.getElementById('dropZone');
|
|
| 550 |
|
| 551 |
// Initialize feather icons
|
| 552 |
feather.replace();
|
| 553 |
-
</script>
|
| 554 |
</body>
|
| 555 |
-
</html>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Swiss Army Web Tools 🛠️</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
|
|
| 53 |
<button class="tab-btn px-6 py-3 font-medium text-gray-500 hover:text-indigo-600" data-tab="shortener">Link Shortener</button>
|
| 54 |
<button class="tab-btn px-6 py-3 font-medium text-gray-500 hover:text-indigo-600" data-tab="bgremover">BG Remover</button>
|
| 55 |
<button class="tab-btn px-6 py-3 font-medium text-gray-500 hover:text-indigo-600" data-tab="password">Password Gen</button>
|
| 56 |
+
</div>
|
| 57 |
|
| 58 |
<div class="p-6">
|
| 59 |
<!-- QR Code Generator -->
|
|
|
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
<p class="text-sm text-gray-500">Scan the QR code with your phone</p>
|
| 85 |
+
</div>
|
| 86 |
</div>
|
| 87 |
</div>
|
| 88 |
|
|
|
|
| 153 |
</div>
|
| 154 |
</div>
|
| 155 |
</div>
|
| 156 |
+
|
| 157 |
+
<!-- Text Counter -->
|
| 158 |
<div id="counter" class="tab-content">
|
| 159 |
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Text & Character Counter</h2>
|
| 160 |
<div class="mb-4">
|
|
|
|
| 197 |
</div>
|
| 198 |
</div>
|
| 199 |
</div>
|
| 200 |
+
|
| 201 |
<!-- Background Remover -->
|
| 202 |
<div id="bgremover" class="tab-content">
|
| 203 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Background Remover</h2>
|
| 204 |
<div class="mb-4">
|
| 205 |
<label for="imageUpload" class="block text-gray-700 mb-2">Upload image</label>
|
| 206 |
<div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center cursor-pointer hover:border-indigo-400 transition" id="dropZone">
|
|
|
|
| 243 |
<p>Made with <i data-feather="heart" class="inline text-red-500 w-4 h-4"></i> for the web</p>
|
| 244 |
</footer>
|
| 245 |
</div>
|
| 246 |
+
|
| 247 |
<script>
|
| 248 |
// Tab switching
|
| 249 |
document.querySelectorAll('.tab-btn').forEach(btn => {
|
|
|
|
| 269 |
});
|
| 270 |
});
|
| 271 |
|
| 272 |
+
// QR Code Generator
|
|
|
|
| 273 |
document.getElementById('generateQR').addEventListener('click', () => {
|
| 274 |
const text = document.getElementById('qrText').value.trim();
|
| 275 |
if (!text) {
|
|
|
|
| 314 |
const sentences = text.trim() ? text.split(/[.!?]+/).filter(s => s.trim().length > 0).length : 0;
|
| 315 |
document.getElementById('sentenceCount').textContent = sentences;
|
| 316 |
});
|
| 317 |
+
|
| 318 |
// Link Shortener with Rebrandly API
|
| 319 |
document.getElementById('shortenBtn').addEventListener('click', async () => {
|
| 320 |
const longUrl = document.getElementById('longUrl').value.trim();
|
|
|
|
| 348 |
alert('Failed to shorten URL. Please try again later.');
|
| 349 |
}
|
| 350 |
});
|
| 351 |
+
|
| 352 |
+
document.getElementById('copyShortUrl').addEventListener('click', () => {
|
| 353 |
const shortUrl = document.getElementById('shortUrl');
|
| 354 |
shortUrl.select();
|
| 355 |
document.execCommand('copy');
|
|
|
|
| 363 |
feather.replace();
|
| 364 |
}, 2000);
|
| 365 |
});
|
| 366 |
+
|
| 367 |
// Background Remover with remove.bg API
|
| 368 |
+
const dropZone = document.getElementById('dropZone');
|
| 369 |
const fileInput = document.getElementById('imageUpload');
|
| 370 |
|
| 371 |
dropZone.addEventListener('click', () => fileInput.click());
|
|
|
|
| 415 |
};
|
| 416 |
reader.readAsDataURL(file);
|
| 417 |
}
|
| 418 |
+
|
| 419 |
document.getElementById('removeBgBtn').addEventListener('click', async () => {
|
| 420 |
const preview = document.getElementById('bgRemoverPreview');
|
| 421 |
const originalImg = document.getElementById('originalImage');
|
|
|
|
| 455 |
link.href = processedImg.src;
|
| 456 |
link.click();
|
| 457 |
});
|
| 458 |
+
|
| 459 |
// Password Generator
|
| 460 |
document.getElementById('passwordLength').addEventListener('input', function() {
|
| 461 |
document.getElementById('lengthValue').textContent = this.value;
|
|
|
|
| 557 |
|
| 558 |
// Initialize feather icons
|
| 559 |
feather.replace();
|
| 560 |
+
</script>
|
| 561 |
</body>
|
| 562 |
+
</html>
|