npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

botblockers

v1.0.3

Published

A simple and effective CAPTCHA library to protect your website from bots.

Downloads

12

Readme

Bot Blockers is a lightweight CAPTCHA library designed to be easy to integrate into any website. It provides multiple CAPTCHA types including text, emojis, letters, colors, and shapes. This documentation will guide you through the installation, configuration, and usage of Bot Blockers.

Table of Contents

Installation

To use Bot Blockers, include the CSS and JavaScript files from the CDN:

<script src="https://npmjs-cdn-app.vercel.app/cdn/npm/botblockers/botblocker.js" defer></script>

Usage

HTML Setup

Add the following script to your HTML file to initialize Bot Blockers:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Usage Bot Blockers</title>
    <script src="https://npmjs-cdn-app.vercel.app/cdn/npm/botblockers/botblocker.js" defer></script>
</head>
<body>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
          initializeBotBlocker({
                type: 'emoji', // Change this to 'text', 'letters', 'colors', or 'shapes' to switch CAPTCHA type
                cssPath: 'https://npmjs-cdn-app.vercel.app/cdn/npm/botblockers/botblocker.css',
                canvasId: 'captcha',
                inputId: 'captcha-input',
                buttonId: 'captcha-submit',
                checkboxContainerId: 'robot-checkbox-container',
                modalOverlayId: 'modal-overlay',
                captchaContainerId: 'captcha-container'
            });
        });
    </script>
</body>
</html>

JavaScript Initialization

The initializeBotBlocker function is called when the document is fully loaded. It requires an options object to configure the CAPTCHA.

Configuration Options

  • type: Specifies the type of CAPTCHA (text, emoji, letters, colors, shapes).
  • cssPath: Path to the CSS file.
  • canvasId: D of the CAPTCHA canvas element.
  • inputId: ID of the input element for the CAPTCHA.
  • buttonId: ID of the submit button for the CAPTCHA form.
  • checkboxContainerId: ID of the container for the "I'm not a robot" checkbox.
  • modalOverlayId: ID of the modal overlay element.
  • captchaContainerId: ID of the CAPTCHA container element.

CAPTCHA Types

Text CAPTCHA

Generates a CAPTCHA with random alphanumeric characters.

Emoji CAPTCHA

Generates a CAPTCHA with random emojis.

Letter CAPTCHA

Generates a CAPTCHA with random letters.

Color CAPTCHA

Generates a CAPTCHA with random colors. Users need to select the correct colors from a palette.

Shape CAPTCHA

Generates a CAPTCHA with random shapes. Users need to select the correct shapes from a palette.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Bot Blockers Example Usage</title>
  <script src="https://npmjs-cdn-app.vercel.app/cdn/npm/botblockers/botblocker.js" defer></script>
</head>
<body>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    initializeBotBlocker({
      type: 'colors',
      cssPath: 'botblocker.css',
      canvasId: 'captcha',
      inputId: 'captcha-input',
      buttonId: 'captcha-submit',
      checkboxContainerId: 'robot-checkbox-container',
      modalOverlayId: 'modal-overlay',
      captchaContainerId: 'captcha-container'
    });
  });
</script>
</body>
</html>