Version 1.1 Documentation

πŸ›‘οΈ aCAPTCHA v1.1

A lightweight, no-backend CAPTCHA system designed for modern web applications. Supports visual challenges, audio verification, hybrid modes, and tracks client-side analyticsβ€”all while being self-contained and secure.

πŸš€ Features Overview

Everything you need for modern CAPTCHA verification

βœ…
Visual CAPTCHA grid
πŸ”Š
Audio CAPTCHA (with fallback speech)
🎯
Hybrid mode (visual + audio)
πŸŒ™
Built-in Dark Mode
πŸ“ˆ
Success rate, average time, and difficulty analytics
πŸ’Ύ
LocalStorage settings (sound & dark mode)
πŸ”
Anti-inspection security (DevTools detection, obfuscation)
πŸ“¦
No backend or API required

πŸ“ Installation & Setup

Get started in under 2 minutes

1. Include the Script

πŸ“„ HTML Include
HTML
<script src="captcha-v1.1.js" defer></script>

2. Use the Custom Component

🧩 Basic Usage
HTML
<captcha-element></captcha-element>
βœ…
That's it! You now have a working CAPTCHA with all default features enabled.

🧠 Challenge Types

Choose the verification method that fits your needs

Type Description Usage Example
visual Standard image grid puzzle <captcha-element type="visual"></captcha-element>
audio 4-digit audio verification <captcha-element type="audio"></captcha-element>
both Hybrid; lets users switch modes <captcha-element type="both"></captcha-element>

πŸŒ— Dark Mode

Enable dark mode for better user experience in low-light environments:

πŸŒ™ Dark Mode Example
HTML
<captcha-element type="both" dark-mode="true"></captcha-element>
πŸ’‘
Dark mode is also toggleable in the UI settings panel for user convenience.

πŸ”Š Audio CAPTCHA – Self Hosting

Critical setup information for offline environments

⚠️
Critical Note: If you are running this offline or self-hosted, the sounds/ folder must be placed in the same directory as captcha-v1.1.js.

Required Audio Files Structure

πŸ“ Directory Structure
TREE
sounds/
β”œβ”€β”€ 0.mp3
β”œβ”€β”€ 1.mp3
β”œβ”€β”€ 2.mp3
β”œβ”€β”€ 3.mp3
β”œβ”€β”€ 4.mp3
β”œβ”€β”€ 5.mp3
β”œβ”€β”€ 6.mp3
β”œβ”€β”€ 7.mp3
β”œβ”€β”€ 8.mp3
└── 9.mp3
πŸ”„
Fallback Behavior: If audio files are missing or incorrect, the system will automatically fall back to speech synthesis (not recommended for critical use).

πŸ”§ Customization via Attributes

Configure your CAPTCHA with simple HTML attributes

Attribute Description Accepted Values Default
type Challenge type visual, audio, both both
dark-mode Enable dark mode true, false false
sound-enabled Enable sound effects true, false true

βœ… Full HTML Examples

Complete implementation examples for different use cases

πŸ”Ή Example 1: Visual Only

πŸ‘οΈ Visual CAPTCHA Only
HTML
<captcha-element type="visual"></captcha-element>

πŸ”Ή Example 2: Audio Only

πŸ”Š Audio CAPTCHA with Dark Mode
HTML
<captcha-element type="audio" dark-mode="true"></captcha-element>

πŸ”Ή Example 3: Full Hybrid Setup with Form

🎯 Complete Form Integration
HTML
<form id="my-form">
  <captcha-element id="captcha" type="both" dark-mode="true"></captcha-element>
  <br>
  <button type="submit">Submit</button>
</form>

<script>
  const captcha = document.getElementById('captcha');
  const form = document.getElementById('my-form');

  captcha.addEventListener('verified', (e) => {
    console.log("CAPTCHA passed!", e.detail);
    form.submit(); // or unlock protected actions
  });

  form.addEventListener('submit', (e) => {
    if (!captcha.isValid()) {
      e.preventDefault();
      alert("⚠️ Please complete the CAPTCHA first.");
    }
  });
</script>

πŸ“Š CAPTCHA Stats and Analytics

Built-in tracking for performance insights

Built-in tracking includes:

  • πŸ“ˆ Total attempts
  • βœ… Success rate (percentage)
  • ⏱️ Average solving time (in seconds)
  • 🎯 Count by difficulty level

πŸ“€ Get Analytics Data

πŸ“Š Retrieve Analytics
JS
const stats = document.querySelector('captcha-element').getAnalytics();
console.log(stats);

πŸ“‹ Example Response

πŸ“‹ Analytics Object
JSON
{
  "totalAttempts": 5,
  "successRate": 80,
  "averageTime": 13,
  "difficultyCounts": {
    "easy": 2,
    "medium": 2,
    "hard": 1,
    "extreme": 0
  }
}

πŸ§ͺ Programmatic Control

JavaScript API for advanced integration

βž• Get Status

πŸ” Check CAPTCHA Status
JS
captcha.getStatus(); // returns 'true' or 'null'
captcha.isValid();   // returns true if passed

πŸ” Reset CAPTCHA

πŸ”„ Reset Function
JS
captcha.reset();

Event Triggered:

πŸ“‘ Reset Event Listener
JS
captcha.addEventListener('reset', () => {
  console.log("CAPTCHA reset by user");
});

πŸ” Security & Anti-Bot Features

Built-in protection against automated attacks

aCAPTCHA includes the following security features:

  • πŸ” DevTools detection (via viewport delta)
  • πŸ”’ Obfuscated inner HTML and injected junk nodes
  • 🚫 Right-click + keybinding prevention
  • πŸ›‘οΈ UI inspection protection
  • πŸ“± Scroll-lock and element focus override
  • πŸŒ‘ Shadow DOM encapsulation
πŸ’‘
Client-Side Security: These defenses are fully client-side and do not require a backend. They provide reasonable protection against basic automated attacks while maintaining ease of use.

🧩 Feature Summary

Complete overview of all included features

Feature Included
Visual Grid Challengeβœ…
Audio Numbers (0-9) Challengeβœ…
Hybrid Switchingβœ…
Dark Mode Toggleβœ…
Sound Effects (optional)βœ…
Stats Tracking (client-side)βœ…
Shadow DOM Encapsulationβœ…
DevTool Detectionβœ…
Offline Support w/ Audio Filesβœ…
Fully Custom HTML Componentβœ…

πŸ’¬ Have Feedback?

This CAPTCHA is designed to be lightweight and modular. If you need hooks, server-side integrations, or custom challenge logicβ€”just reach out or fork it. we I am always looking to improve the user experience while maintaining security.