# @berlinsms/captcha-wrapper

> jQuery-Plugin to wrap different kinds of captchas. The libraries of the unused captchas are not loaded.

Latest version **1.0.4** (published 2023-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @berlinsms/captcha-wrapper
pnpm add @berlinsms/captcha-wrapper
yarn add @berlinsms/captcha-wrapper
bun add @berlinsms/captcha-wrapper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2023-10-04 |
| First published | 2023-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 46.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | haka for berlinsms |
| Maintainers | berlinsms-dev, alexw_berlinsms, hagen.meutzner |
| Keywords | js, captcha, wrapper, hcaptcha, recaptcha, jquery |

## Links

- npm: https://www.npmjs.com/package/@berlinsms/captcha-wrapper
- npm.io page: https://npm.io/package/@berlinsms/captcha-wrapper

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.4 (latest) — 2023-10-04

## README

# jQuery CaptchaWrapper
[Homepage](https://www.berlinsms.de/)

# Description

This captcha wrapper makes it easy to include multiple types of captcha on your site. 

This can be helpful if, for example, you want to let your customers choose the type of captcha.

The libraries of the unused captchas are not loaded.

# Usage

Include jquery    
```html
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
```

Download bsms-captcha-wrapper
```link
https://static.berlinsms.de/toolsforcoder/captcha-wrapper/dist/bsms-captcha-wrapper.min.js
```

Include bsms-captcha-wrapper
```html
<script src="bsms-captcha-wrapper.min.js"></script>
```

Find your jquery-container and assign captcha-wrapper
```js
$('.plugin-container').bsmsCaptchaWrapper();    
```

Make sure, the script is fully loaded, before you assign captcha-wrapper, e.g. use jquerys 'ready'
```js
$(document).ready(function () {
    $('.plugin-container').bsmsCaptchaWrapper();
});    
```

Provide options:
```js
$(document).ready(()=>{
    $('.plugin-container').bsmsCaptchaWrapper( { sitekey:'asdfghjklasdfghjkl' } );
});    
```

Provide callbacks:
```js
$(document).ready(function () {
    $('.plugin-container')
        .bsmsCaptchaWrapper( { sitekey:'asdfghjklasdfghjkl' } )
        .onSolved(captchaSolved)
        .onExpired(captchaExpired);
});    
function captchaSolved(token) {
    alert(`Captcha solved with token=${token}`);
}
function captchaExpired() {
    alert(`Captcha expired`);
}
```

# Options

| Option      | DESCRIPTION                                                                                                                                               | DEFAULT                    |
|-------------|---------------------------------------------------------------|-----------|
| captchaType | Type of captcha used. Feel free to add more types of captchas | reCaptcha |
| sitekey     | Sitekey of recaptcha or hcaptcha or anycaptcha                |           |
| onLoad      | Callback that fires when the captcha has loaded               | null      |
| onSolved    | Callback that is triggered when the captcha has been solved   | null      |
| onExpired   | Callback triggered when the captcha expires                   | null      |
| onError     | Callback, will be triggered, if something is wrong            | null      |

---
_Source: https://npm.io/package/@berlinsms/captcha-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
