operator-cursor
Advanced tools
Comparing version
{ | ||
"name": "operator-cursor", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "👻 A phantom cursor that navigates and interacts with web pages like a human operator", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -29,3 +29,3 @@ // ========================================== | ||
this.animationQueue = []; | ||
this.init(); | ||
@@ -57,3 +57,3 @@ } | ||
this.cursorElement.className = 'operator-cursor'; | ||
// 👻 Crear icono del cursor (puntero + bot indicator) | ||
@@ -81,3 +81,3 @@ this.cursorElement.innerHTML = ` | ||
style.id = 'operator-cursor-styles'; | ||
// 🎨 Colores dinámicos | ||
@@ -87,4 +87,4 @@ const primaryColor = this.options.cursorColor; | ||
const lighterColor = this.lightenColor(primaryColor, 20); | ||
style.textContent = ` | ||
style.textContent = ` | ||
/* 🤖 Operator Cursor Principal */ | ||
@@ -133,4 +133,4 @@ .operator-cursor { | ||
position: absolute; | ||
top: -10px; | ||
right: -10px; | ||
top: -8px; | ||
right: -5px; | ||
width: 20px; | ||
@@ -250,3 +250,3 @@ height: 20px; | ||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | ||
return result ? | ||
return result ? | ||
parseInt(result[1], 16) + ', ' + parseInt(result[2], 16) + ', ' + parseInt(result[3], 16) : | ||
@@ -257,3 +257,3 @@ '99, 102, 241'; // fallback púrpura | ||
lightenColor(hex, percent) { | ||
const num = parseInt(hex.replace("#",""), 16); | ||
const num = parseInt(hex.replace("#", ""), 16); | ||
const amt = Math.round(2.55 * percent); | ||
@@ -339,3 +339,3 @@ const R = (num >> 16) + amt; | ||
this.cursorElement.classList.add('hovering'); | ||
setTimeout(() => { | ||
@@ -345,3 +345,3 @@ // Animación de click | ||
this.cursorElement.classList.add('clicking'); | ||
// Sonido opcional | ||
@@ -378,6 +378,6 @@ if (this.options.sound) { | ||
await this.moveToElement(element); | ||
// Indicar que está escribiendo | ||
this.cursorElement.classList.add('typing'); | ||
// Escribir letra por letra | ||
@@ -387,9 +387,9 @@ for (let i = 0; i < text.length; i++) { | ||
element.value = text.substring(0, i + 1); | ||
// Trigger input event | ||
element.dispatchEvent(new Event('input', { bubbles: true })); | ||
} | ||
this.cursorElement.classList.remove('typing'); | ||
if (this.options.debug) { | ||
@@ -428,5 +428,5 @@ console.log(`[OperatorCursor] Terminó de escribir: "${text}"`); | ||
trail.style.top = `${y}px`; | ||
document.body.appendChild(trail); | ||
// Remover después de la animación | ||
@@ -446,12 +446,12 @@ setTimeout(() => { | ||
const gainNode = audioContext.createGain(); | ||
oscillator.connect(gainNode); | ||
gainNode.connect(audioContext.destination); | ||
oscillator.frequency.setValueAtTime(800, audioContext.currentTime); | ||
oscillator.frequency.exponentialRampToValueAtTime(400, audioContext.currentTime + 0.1); | ||
gainNode.gain.setValueAtTime(0.1, audioContext.currentTime); | ||
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.1); | ||
oscillator.start(audioContext.currentTime); | ||
@@ -485,3 +485,3 @@ oscillator.stop(audioContext.currentTime + 0.1); | ||
} | ||
const styles = document.getElementById('operator-cursor-styles'); | ||
@@ -491,6 +491,6 @@ if (styles) { | ||
} | ||
// Limpiar trails | ||
document.querySelectorAll('.operator-cursor-trail').forEach(trail => trail.remove()); | ||
if (this.options.debug) { | ||
@@ -497,0 +497,0 @@ console.log('[OperatorCursor] Sistema destruido'); |
49613
-0.17%