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 🙏

© 2025 – Pkg Stats / Ryan Hefner

topnet-captcha

v1.3.0

Published

行为验证器

Readme

Captcha.js

Captcha.js 是一个行为验证器插件,用于实现四种类型的验证码组件。使用该插件前需要先引入 jQuery、Captcha.js 和 Captcha.css。以下是关于如何使用 Captcha.js 的说明:

安装 首先,在你的项目中引入 jQuery、Captcha.js 和 Captcha.css 文件。

$("#createCaptcha").click(function () {
  /**
   * @description: 四个类型的行为验证器插件,需要先引入 jquery, Captcha.js 和 Captcha.css
   * @param {String} selector - 用于指定验证码组件所要附加到的元素的选择器。class 为 .dom,id 为 #dom
   * @param {Object} options - 用于配置验证码组件的选项。
   * @param {String} options.type - 验证码组件的类型,不传默认为 slider 滑块验证码,
   *   - CONCAT(滑动还原验证码)
   *   - ROTATE(旋转验证码)
   *   - WORD*IMAGE_CLICK(点选验证码)
   * @param {String} options.placeholder - 在验证组件中显示的占位文本。
   * @param {String} options.baseUrl - 向验证码服务器发起请求时的基本 URL。
   * @param {Boolean} options.isPrintLog - 是否打印日志
   * @param {Object} options.headers - 在向验证码服务器发起请求时要包含的头部信息。
   * @param {String} options.headers.token - 用于验证向验证码服务器发起请求的令牌。
   * @param {Function} options.successed - 验证码验证成功时要执行的回调函数。
   * @param {Function} options.failed - 验证码验证失败时要执行的回调函数。
   * @returns {Object} - 新创建的验证码组件。
   */
  myComponent = new Captcha("#com", {
    type: "ROTATE",
    placeholder: "拖动滑块到正确位置",
    baseUrl: "xxxx",
    headers: {
      token: "this is token",
    },
    isPrintLog: true,
    successed: function (res) {
      alert("验证成功");
      // myComponent.close() 关闭验证弹窗事件
    },
    failed: function (err) {
      alert("验证失败");
    },
  });
});

参数说明 selector:用于指定验证码组件所要附加到的元素的选择器。

可以使用 class (".dom") 或 id ("#dom")。 options.type(可选):

验证码组件的类型,

默认为 slider(滑块验证码)。

可选值有: CONCAT(滑动还原验证码) ROTATE(旋转验证码) WORD*IMAGE_CLICK(点选验证码) options.placeholder(可选):在验证组件中显示的占位文本。 options.baseUrl(可选):向验证码服务器发起请求时的基本 URL。 options.isPrintLog(可选):是否打印日志。 options.headers(可选):在向验证码服务器发起请求时要包含的头部信息。 options.headers.token(可选):用于验证向验证码服务器发起请求的令牌。 options.successed(可选):验证码验证成功时要执行的回调函数。 options.failed(可选):验证码验证失败时要执行的回调函数。 方法 myComponent.close():关闭验证码弹窗事件。