Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (38 loc) · 1.4 KB
/
Copy pathscript.js
File metadata and controls
46 lines (38 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function generateEmails() {
const emailInput = document.getElementById('emailInput').value;
const emailOutput = document.getElementById('emailOutput');
emailOutput.value = ''; // Clear previous output
const [localPart, domain] = emailInput.split('@');
if (domain !== 'gmail.com') {
alert('Please enter a valid Gmail address.');
return;
}
const emailVariations = new Set();
const length = localPart.length;
// Generate all possible dot placements
const maxCombinations = 1 << (length - 1);
for (let i = 0; i < maxCombinations; i++) {
let newEmail = '';
for (let j = 0; j < length; j++) {
newEmail += localPart[j];
if (j < length - 1 && (i & (1 << j))) {
newEmail += '.';
}
}
emailVariations.add(newEmail + '@gmail.com');
}
emailOutput.value = Array.from(emailVariations).join('\n');
}
function copyEmails() {
const emailOutput = document.getElementById('emailOutput');
const copyButton = document.getElementById('copyButton');
emailOutput.select();
emailOutput.setSelectionRange(0, 99999); // For mobile devices
document.execCommand('copy');
// Change button text to "Copied"
copyButton.textContent = 'Copied';
// Revert back to "Copy All" after 2 seconds
setTimeout(() => {
copyButton.textContent = 'Copy All';
}, 2000);
}