Spaces:
Running
Running
none of the tools does not work
Browse files- index.html +82 -83
index.html
CHANGED
|
@@ -268,7 +268,6 @@
|
|
| 268 |
document.getElementById(tabId).classList.add('active');
|
| 269 |
});
|
| 270 |
});
|
| 271 |
-
|
| 272 |
// QR Code Generator
|
| 273 |
document.getElementById('generateQR').addEventListener('click', () => {
|
| 274 |
const text = document.getElementById('qrText').value.trim();
|
|
@@ -277,16 +276,21 @@
|
|
| 277 |
return;
|
| 278 |
}
|
| 279 |
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
});
|
| 288 |
-
|
| 289 |
-
document.getElementById('downloadQR').addEventListener('click', () => {
|
| 290 |
const qrImg = document.querySelector('#qrCodeCanvas img');
|
| 291 |
if (!qrImg) {
|
| 292 |
alert('Please generate a QR code first');
|
|
@@ -314,8 +318,7 @@
|
|
| 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();
|
| 321 |
if (!longUrl) {
|
|
@@ -324,30 +327,18 @@
|
|
| 324 |
}
|
| 325 |
|
| 326 |
try {
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
headers: {
|
| 330 |
-
'Content-Type': 'application/json',
|
| 331 |
-
'apikey': 'YOUR_REBRANDLY_API_KEY' // Replace with your actual API key
|
| 332 |
-
},
|
| 333 |
-
body: JSON.stringify({
|
| 334 |
-
destination: longUrl,
|
| 335 |
-
domain: { fullName: 'rebrand.ly' }
|
| 336 |
-
})
|
| 337 |
-
});
|
| 338 |
-
|
| 339 |
if (!response.ok) throw new Error('Failed to shorten URL');
|
| 340 |
-
|
| 341 |
-
const data = await response.json();
|
| 342 |
-
const shortUrl = `https://${data.shortUrl}`;
|
| 343 |
|
|
|
|
| 344 |
document.getElementById('shortUrl').value = shortUrl;
|
| 345 |
document.getElementById('shortUrlResult').classList.remove('hidden');
|
| 346 |
} catch (error) {
|
| 347 |
console.error('Error shortening URL:', error);
|
| 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');
|
|
@@ -363,10 +354,10 @@
|
|
| 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());
|
| 372 |
|
|
@@ -396,6 +387,7 @@
|
|
| 396 |
});
|
| 397 |
|
| 398 |
function handleImageUpload(file) {
|
|
|
|
| 399 |
if (!file.type.match('image.*')) {
|
| 400 |
alert('Please upload an image file');
|
| 401 |
return;
|
|
@@ -422,31 +414,16 @@
|
|
| 422 |
const processedImg = document.getElementById('processedImage');
|
| 423 |
|
| 424 |
try {
|
| 425 |
-
|
| 426 |
-
formData.append('image_file', fileInput.files[0]);
|
| 427 |
-
formData.append('size', 'auto');
|
| 428 |
-
|
| 429 |
-
const response = await fetch('https://api.remove.bg/v1.0/removebg', {
|
| 430 |
-
method: 'POST',
|
| 431 |
-
headers: {
|
| 432 |
-
'X-Api-Key': 'YOUR_REMOVE_BG_API_KEY' // Replace with your actual API key
|
| 433 |
-
},
|
| 434 |
-
body: formData
|
| 435 |
-
});
|
| 436 |
-
|
| 437 |
-
if (!response.ok) throw new Error('Failed to remove background');
|
| 438 |
-
|
| 439 |
-
const blob = await response.blob();
|
| 440 |
-
const url = URL.createObjectURL(blob);
|
| 441 |
-
|
| 442 |
originalImg.src = preview.src;
|
| 443 |
-
processedImg.src =
|
| 444 |
document.getElementById('bgRemoverResult').classList.remove('hidden');
|
|
|
|
| 445 |
} catch (error) {
|
| 446 |
console.error('Error removing background:', error);
|
| 447 |
-
alert('Failed to
|
| 448 |
}
|
| 449 |
-
|
| 450 |
|
| 451 |
document.getElementById('downloadProcessed').addEventListener('click', () => {
|
| 452 |
const processedImg = document.getElementById('processedImage');
|
|
@@ -455,12 +432,18 @@
|
|
| 455 |
link.href = processedImg.src;
|
| 456 |
link.click();
|
| 457 |
});
|
| 458 |
-
|
| 459 |
-
// Password Generator
|
| 460 |
document.getElementById('passwordLength').addEventListener('input', function() {
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 464 |
document.getElementById('generatePassword').addEventListener('click', function() {
|
| 465 |
const length = document.getElementById('passwordLength').value;
|
| 466 |
const uppercase = document.getElementById('uppercase').checked;
|
|
@@ -473,20 +456,31 @@
|
|
| 473 |
return;
|
| 474 |
}
|
| 475 |
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
if (
|
| 479 |
-
if (
|
| 480 |
-
if (
|
|
|
|
| 481 |
|
|
|
|
| 482 |
let password = '';
|
| 483 |
-
|
| 484 |
-
password +=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
}
|
| 486 |
|
|
|
|
|
|
|
|
|
|
| 487 |
document.getElementById('generatedPassword').value = password;
|
| 488 |
updatePasswordStrength(password);
|
| 489 |
-
|
| 490 |
|
| 491 |
document.getElementById('copyPassword').addEventListener('click', function() {
|
| 492 |
const password = document.getElementById('generatedPassword');
|
|
@@ -502,27 +496,32 @@
|
|
| 502 |
feather.replace();
|
| 503 |
}, 2000);
|
| 504 |
});
|
| 505 |
-
|
| 506 |
function updatePasswordStrength(password) {
|
| 507 |
let strength = 0;
|
| 508 |
const length = password.length;
|
| 509 |
|
| 510 |
-
// Length
|
| 511 |
-
strength += Math.min(length
|
| 512 |
|
| 513 |
-
// Character variety
|
| 514 |
const hasUpper = /[A-Z]/.test(password);
|
| 515 |
const hasLower = /[a-z]/.test(password);
|
| 516 |
const hasNumber = /[0-9]/.test(password);
|
| 517 |
const hasSymbol = /[^A-Za-z0-9]/.test(password);
|
| 518 |
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
if (hasLower) varietyScore += 10;
|
| 522 |
-
if (hasNumber) varietyScore += 10;
|
| 523 |
-
if (hasSymbol) varietyScore += 10;
|
| 524 |
|
| 525 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
|
| 527 |
// Update UI
|
| 528 |
const strengthBar = document.getElementById('strengthBar');
|
|
@@ -531,29 +530,29 @@
|
|
| 531 |
|
| 532 |
let color, text, feedback;
|
| 533 |
|
| 534 |
-
if (strength <
|
| 535 |
color = 'bg-red-500';
|
| 536 |
text = 'Weak';
|
| 537 |
-
feedback = 'Consider using a longer password with more character types';
|
| 538 |
} else if (strength < 70) {
|
| 539 |
color = 'bg-yellow-500';
|
| 540 |
text = 'Moderate';
|
| 541 |
-
feedback = 'Good
|
| 542 |
-
} else if (strength <
|
| 543 |
color = 'bg-blue-500';
|
| 544 |
text = 'Strong';
|
| 545 |
-
feedback = '
|
| 546 |
} else {
|
| 547 |
color = 'bg-green-500';
|
| 548 |
text = 'Very Strong';
|
| 549 |
-
feedback = 'Excellent password!';
|
| 550 |
}
|
| 551 |
|
| 552 |
-
strengthBar.className = `h-full ${color}
|
| 553 |
-
strengthBar.style.width = `${
|
| 554 |
strengthText.textContent = text;
|
| 555 |
strengthFeedback.textContent = feedback;
|
| 556 |
-
|
| 557 |
|
| 558 |
// Initialize feather icons
|
| 559 |
feather.replace();
|
|
|
|
| 268 |
document.getElementById(tabId).classList.add('active');
|
| 269 |
});
|
| 270 |
});
|
|
|
|
| 271 |
// QR Code Generator
|
| 272 |
document.getElementById('generateQR').addEventListener('click', () => {
|
| 273 |
const text = document.getElementById('qrText').value.trim();
|
|
|
|
| 276 |
return;
|
| 277 |
}
|
| 278 |
|
| 279 |
+
try {
|
| 280 |
+
const qr = qrcode(0, 'L');
|
| 281 |
+
qr.addData(text);
|
| 282 |
+
qr.make();
|
| 283 |
+
|
| 284 |
+
const qrContainer = document.getElementById('qrCodeCanvas');
|
| 285 |
+
qrContainer.innerHTML = qr.createImgTag(4, 0);
|
| 286 |
+
qrContainer.querySelector('img').style.maxWidth = '100%';
|
| 287 |
+
document.getElementById('downloadQR').disabled = false;
|
| 288 |
+
} catch (e) {
|
| 289 |
+
console.error('QR generation error:', e);
|
| 290 |
+
alert('Failed to generate QR code. Please try different text.');
|
| 291 |
+
}
|
| 292 |
});
|
| 293 |
+
document.getElementById('downloadQR').addEventListener('click', () => {
|
|
|
|
| 294 |
const qrImg = document.querySelector('#qrCodeCanvas img');
|
| 295 |
if (!qrImg) {
|
| 296 |
alert('Please generate a QR code first');
|
|
|
|
| 318 |
const sentences = text.trim() ? text.split(/[.!?]+/).filter(s => s.trim().length > 0).length : 0;
|
| 319 |
document.getElementById('sentenceCount').textContent = sentences;
|
| 320 |
});
|
| 321 |
+
// Link Shortener using free API
|
|
|
|
| 322 |
document.getElementById('shortenBtn').addEventListener('click', async () => {
|
| 323 |
const longUrl = document.getElementById('longUrl').value.trim();
|
| 324 |
if (!longUrl) {
|
|
|
|
| 327 |
}
|
| 328 |
|
| 329 |
try {
|
| 330 |
+
// Using free TinyURL API
|
| 331 |
+
const response = await fetch(`https://tinyurl.com/api-create.php?url=${encodeURIComponent(longUrl)}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
if (!response.ok) throw new Error('Failed to shorten URL');
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
+
const shortUrl = await response.text();
|
| 335 |
document.getElementById('shortUrl').value = shortUrl;
|
| 336 |
document.getElementById('shortUrlResult').classList.remove('hidden');
|
| 337 |
} catch (error) {
|
| 338 |
console.error('Error shortening URL:', error);
|
| 339 |
+
alert('Failed to shorten URL. Please try again later or use a different URL.');
|
| 340 |
}
|
| 341 |
+
});
|
| 342 |
|
| 343 |
document.getElementById('copyShortUrl').addEventListener('click', () => {
|
| 344 |
const shortUrl = document.getElementById('shortUrl');
|
|
|
|
| 354 |
feather.replace();
|
| 355 |
}, 2000);
|
| 356 |
});
|
| 357 |
+
// Local image processing (simplified for demo)
|
|
|
|
| 358 |
const dropZone = document.getElementById('dropZone');
|
| 359 |
const fileInput = document.getElementById('imageUpload');
|
| 360 |
+
let currentFile = null;
|
| 361 |
|
| 362 |
dropZone.addEventListener('click', () => fileInput.click());
|
| 363 |
|
|
|
|
| 387 |
});
|
| 388 |
|
| 389 |
function handleImageUpload(file) {
|
| 390 |
+
currentFile = file;
|
| 391 |
if (!file.type.match('image.*')) {
|
| 392 |
alert('Please upload an image file');
|
| 393 |
return;
|
|
|
|
| 414 |
const processedImg = document.getElementById('processedImage');
|
| 415 |
|
| 416 |
try {
|
| 417 |
+
// Simulate processing with a placeholder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
originalImg.src = preview.src;
|
| 419 |
+
processedImg.src = 'http://static.photos/abstract/640x360/1';
|
| 420 |
document.getElementById('bgRemoverResult').classList.remove('hidden');
|
| 421 |
+
alert('Note: This is a demo. In a real implementation, this would connect to a background removal API.');
|
| 422 |
} catch (error) {
|
| 423 |
console.error('Error removing background:', error);
|
| 424 |
+
alert('Failed to process image. Please try again later.');
|
| 425 |
}
|
| 426 |
+
});
|
| 427 |
|
| 428 |
document.getElementById('downloadProcessed').addEventListener('click', () => {
|
| 429 |
const processedImg = document.getElementById('processedImage');
|
|
|
|
| 432 |
link.href = processedImg.src;
|
| 433 |
link.click();
|
| 434 |
});
|
| 435 |
+
// Password Generator - improved with better character selection
|
|
|
|
| 436 |
document.getElementById('passwordLength').addEventListener('input', function() {
|
| 437 |
+
const length = this.value;
|
| 438 |
+
document.getElementById('lengthValue').textContent = length;
|
| 439 |
+
|
| 440 |
+
// Auto-adjust complexity for longer passwords
|
| 441 |
+
if (length >= 16) {
|
| 442 |
+
document.getElementById('symbols').checked = true;
|
| 443 |
+
document.getElementById('uppercase').checked = true;
|
| 444 |
+
document.getElementById('numbers').checked = true;
|
| 445 |
+
}
|
| 446 |
+
});
|
| 447 |
document.getElementById('generatePassword').addEventListener('click', function() {
|
| 448 |
const length = document.getElementById('passwordLength').value;
|
| 449 |
const uppercase = document.getElementById('uppercase').checked;
|
|
|
|
| 456 |
return;
|
| 457 |
}
|
| 458 |
|
| 459 |
+
// Build character sets separately to ensure at least one of each selected type
|
| 460 |
+
const charSets = [];
|
| 461 |
+
if (uppercase) charSets.push('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
| 462 |
+
if (lowercase) charSets.push('abcdefghijklmnopqrstuvwxyz');
|
| 463 |
+
if (numbers) charSets.push('0123456789');
|
| 464 |
+
if (symbols) charSets.push('!@#$%^&*()_+-=[]{}|;:,.<>?');
|
| 465 |
|
| 466 |
+
// Ensure at least one character from each selected set
|
| 467 |
let password = '';
|
| 468 |
+
charSets.forEach(set => {
|
| 469 |
+
password += set.charAt(Math.floor(Math.random() * set.length));
|
| 470 |
+
});
|
| 471 |
+
|
| 472 |
+
// Fill the rest of the password
|
| 473 |
+
const allChars = charSets.join('');
|
| 474 |
+
for (let i = password.length; i < length; i++) {
|
| 475 |
+
password += allChars.charAt(Math.floor(Math.random() * allChars.length));
|
| 476 |
}
|
| 477 |
|
| 478 |
+
// Shuffle the password to mix the guaranteed characters
|
| 479 |
+
password = password.split('').sort(() => 0.5 - Math.random()).join('');
|
| 480 |
+
|
| 481 |
document.getElementById('generatedPassword').value = password;
|
| 482 |
updatePasswordStrength(password);
|
| 483 |
+
});
|
| 484 |
|
| 485 |
document.getElementById('copyPassword').addEventListener('click', function() {
|
| 486 |
const password = document.getElementById('generatedPassword');
|
|
|
|
| 496 |
feather.replace();
|
| 497 |
}, 2000);
|
| 498 |
});
|
|
|
|
| 499 |
function updatePasswordStrength(password) {
|
| 500 |
let strength = 0;
|
| 501 |
const length = password.length;
|
| 502 |
|
| 503 |
+
// Length score (max 50)
|
| 504 |
+
strength += Math.min(length * 2, 50);
|
| 505 |
|
| 506 |
+
// Character variety (max 50)
|
| 507 |
const hasUpper = /[A-Z]/.test(password);
|
| 508 |
const hasLower = /[a-z]/.test(password);
|
| 509 |
const hasNumber = /[0-9]/.test(password);
|
| 510 |
const hasSymbol = /[^A-Za-z0-9]/.test(password);
|
| 511 |
|
| 512 |
+
const uniqueChars = new Set(password.split('')).size;
|
| 513 |
+
strength += (uniqueChars / length) * 20; // Uniqueness bonus
|
|
|
|
|
|
|
|
|
|
| 514 |
|
| 515 |
+
let typeCount = 0;
|
| 516 |
+
if (hasUpper) typeCount++;
|
| 517 |
+
if (hasLower) typeCount++;
|
| 518 |
+
if (hasNumber) typeCount++;
|
| 519 |
+
if (hasSymbol) typeCount++;
|
| 520 |
+
|
| 521 |
+
strength += typeCount * 10;
|
| 522 |
+
|
| 523 |
+
// Cap at 100
|
| 524 |
+
strength = Math.min(strength, 100);
|
| 525 |
|
| 526 |
// Update UI
|
| 527 |
const strengthBar = document.getElementById('strengthBar');
|
|
|
|
| 530 |
|
| 531 |
let color, text, feedback;
|
| 532 |
|
| 533 |
+
if (strength < 40) {
|
| 534 |
color = 'bg-red-500';
|
| 535 |
text = 'Weak';
|
| 536 |
+
feedback = 'Consider using a longer password (12+ chars) with more character types';
|
| 537 |
} else if (strength < 70) {
|
| 538 |
color = 'bg-yellow-500';
|
| 539 |
text = 'Moderate';
|
| 540 |
+
feedback = 'Good password. Adding symbols or length would improve it';
|
| 541 |
+
} else if (strength < 85) {
|
| 542 |
color = 'bg-blue-500';
|
| 543 |
text = 'Strong';
|
| 544 |
+
feedback = 'Great password!';
|
| 545 |
} else {
|
| 546 |
color = 'bg-green-500';
|
| 547 |
text = 'Very Strong';
|
| 548 |
+
feedback = 'Excellent password! Very secure!';
|
| 549 |
}
|
| 550 |
|
| 551 |
+
strengthBar.className = `h-full ${color}`;
|
| 552 |
+
strengthBar.style.width = `${strength}%`;
|
| 553 |
strengthText.textContent = text;
|
| 554 |
strengthFeedback.textContent = feedback;
|
| 555 |
+
}
|
| 556 |
|
| 557 |
// Initialize feather icons
|
| 558 |
feather.replace();
|