auto-captcha-solver
Version:
Automatically detect and solve various captcha types in Playwright & Puppeteer with 2Captcha/CapMonster Cloud integration
102 lines (95 loc) • 4.05 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.captchaLoading = captchaLoading;
async function captchaLoading(page) {
await page.evaluate(`(function() {
if (!document.getElementById('captcha-loading')) {
// Create background blur overlay
const blurOverlay = document.createElement('div');
blurOverlay.id = 'captcha-blur-overlay';
Object.assign(blurOverlay.style, {
position: 'fixed',
top: '0',
left: '0',
width: '100vw',
height: '100vh',
background: 'rgba(0, 0, 0, 0.6)',
backdropFilter: 'blur(8px)',
zIndex: '99998'
});
// Create loader container
const loaderContainer = document.createElement('div');
loaderContainer.id = 'captcha-loading';
Object.assign(loaderContainer.style, {
position: 'fixed',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
background: 'rgba(0, 0, 0, 0.85)',
color: 'white',
padding: '20px',
borderRadius: '12px',
fontSize: '16px',
textAlign: 'center',
zIndex: '99999',
boxShadow: '0 4px 20px rgba(0, 255, 255, 0.8)',
display: 'flex',
flexDirection: 'column',
alignItems: 'center'
});
// Create spinner
const spinner = document.createElement('div');
spinner.id = 'captcha-spinner';
Object.assign(spinner.style, {
width: '50px',
height: '50px',
border: '5px solid rgba(0, 255, 255, 0.3)',
borderTop: '5px solid cyan',
borderRadius: '50%',
animation: 'spin 1s linear infinite',
marginBottom: '15px'
});
// Create pulsating effect ring
const pulseRing = document.createElement('div');
Object.assign(pulseRing.style, {
width: '70px',
height: '70px',
border: '4px solid rgba(0, 255, 255, 0.5)',
borderRadius: '50%',
position: 'absolute',
animation: 'pulse 1.5s infinite'
});
// Create text
const text = document.createElement('div');
text.innerText = 'Solving CAPTCHA...';
text.style.fontSize = '14px';
text.style.opacity = '0.9';
text.style.fontWeight = 'bold';
text.style.marginBottom = '-10px';
// Append elements
document.body.appendChild(blurOverlay);
loaderContainer.appendChild(pulseRing);
loaderContainer.appendChild(spinner);
loaderContainer.appendChild(text);
document.body.appendChild(loaderContainer);
// Add animations via a separate style tag
const style = document.createElement('style');
style.innerHTML =
'@keyframes spin {' +
' 0% { transform: rotate(0deg); }' +
' 100% { transform: rotate(360deg); }' +
'}' +
'@keyframes fadeIn {' +
' from { opacity: 0; transform: scale(0.8); }' +
' to { opacity: 1; transform: scale(1); }' +
'}' +
'@keyframes pulse {' +
' 0% { transform: scale(1); opacity: 0.6; }' +
' 50% { transform: scale(1.2); opacity: 0.3; }' +
' 100% { transform: scale(1.4); opacity: 0; }' +
'}';
document.head.appendChild(style);
}
})();`);
}
//# sourceMappingURL=captcha-loading.js.map