It just grabs some random characters from a string and concats them.
function makeId(length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text
}
function generateUserEmailPassword() {
const email = makeId(4) + "-" + makeId(4) + "-" + makeId(4) + "-" + makeId(4);
const passwordField = makeId(4) + "-" + makeId(4) + "-" + makeId(4) + "-" + makeId(4);
console.log('email', email, 'passwordField', passwordField)
}
generateUserEmailPassword();
Full version, there is some setInterval nonsense here as well.
Summary
https://prizelava.com/wp-content/cache/min/1/df563c74113e35873fe3ff19a0ae0490.js
function initGenerator() {
function makeId(length) {
var text = '';
var possible =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function generateUserEmailPassword(displayArea) {
console.log(displayArea);
var emailField = document.getElementById('custom-field-1');
var passwordField = document.getElementById('custom-field-2');
displayArea.style.height = '200px';
emailField.innerText =
makeId(4) + '-' + makeId(4) + '-' + makeId(4) + '-' + makeId(4);
passwordField.innerText =
makeId(4) + '-' + makeId(4) + '-' + makeId(4) + '-' + makeId(4);
}
function startLoading(ctx) {
var displayArea = document.getElementById('custom-user-data-area');
var elem = document.getElementById('custom-username-generator');
var loader = document.getElementById('loader-custom');
var loadingPercentage = elem.children[0];
var current = 0;
var duration = 59;
displayArea.style.height = '0px';
loadingPercentage.innerText = '0%';
loadingPercentage.style.color = 'black';
loader.style.animationDuration = duration + 's';
ctx.style.display = 'none';
loader.classList.add('animation-loader-custom');
var interval = setInterval(function() {
current += 1;
loadingPercentage.innerText = current + '%';
loader.style.width = current + '%';
if (current >= 100) {
clearInterval(interval);
generateUserEmailPassword(displayArea);
ctx.style.display = 'inline';
loader.style.width = '100%';
loader.classList.remove('animation-loader-custom');
} else if (current >= 48) {
loadingPercentage.style.color = 'white';
}
}, duration * 10);
}
document
.getElementById('generator-button')
.addEventListener('click', function() {
startLoading(this);
});
}
document.addEventListener('DOMContentLoaded', function(event) {
initGenerator();
});
Anyway, that link should/might probably be seen as spam I would think.