// Auto Typer - Types text into any input field
// Usage: Run in console, click the input field, then watch it type
function autoType(text, speed = 100) {
console.log('Click on the input field where you want to type...');
document.addEventListener('click', function captureInput(e) {
if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') {
e.preventDefault();
const input = e.target;
console.log('Typing into:', input);
let index = 0;
const typeInterval = setInterval(() => {
if (index < text.length) {
input.value += text[index];
input.dispatchEvent(new Event('input', { bubbles: true }));
index++;
} else {
clearInterval(typeInterval);
console.log('Typing complete!');
}
}, speed);
document.removeEventListener('click', captureInput, true);
}
}, true);
}
// Example usage:
autoType('Hello, this is auto-typed text! 🚀', 80);
// For realistic human-like typing with variable speed:
function humanType(text, minSpeed = 50, maxSpeed = 150) {
console.log('Click on the input field...');
document.addEventListener('click', function captureInput(e) {
if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') {
e.preventDefault();
const input = e.target;
let index = 0;
function typeChar() {
if (index < text.length) {
input.value += text[index];
input.dispatchEvent(new Event('input', { bubbles: true }));
index++;
const delay = Math.random() * (maxSpeed - minSpeed) + minSpeed;
setTimeout(typeChar, delay);
} else {
console.log('Typing complete!');
}
}
typeChar();
document.removeEventListener('click', captureInput, true);
}
}, true);
}