1.4.1 • Published 4 years ago
@haikel/min-captcha v1.4.1
🔒 Easy & Simple Js Captcha
Demo
$ npm i @haikel/min-captcha --save
Usage
import captcha from '@haikel/min-captcha';
// or
const captcha = require('@haikel/min-captcha');
Or include it via jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/@haikel/min-captcha@1.4.1/index.min.js"></script>
Examples
captcha(object) : object
const { canvas, rndStr } = captcha();
console.log(canvas, rndStr)
// <canvas width="130" height="30"></canvas> "c22"
// or you can specify your own config
const config = { nbChars: 3,charPool: 'abcdef123456' };
const { canvas, rndStr } = captcha(config);
console.log(canvas, rndStr)
// <canvas width="130" height="30"></canvas> "c22"
// by default :
config = {
nbChars : 5,
charPool: 'ABCDEFGHIKLMNOPQRSTVXYZ123456789',
charsColor, // random rgb color
cnvsWidth : 130,
cnvsHeight : 30,
textFont : '18px Arial',
textPosX : 30,
textPosY : 30
};
// textPosX : The x coordinate where to start painting the text (relative to the canvas)
// textPosY : The y coordinate where to start painting the text (relative to the canvas)
Notes
- Supported in all old and modern browsers.
- All pull requests are welcome, feel free.
License
MIT
1.4.1
4 years ago
1.4.0
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago