1 | <h1 align="center">VerifyJs</h1>
|
2 | <div align="center">
|
3 |
|
4 | A lightweight simple puzzle verification plugin.
|
5 |
|
6 | ![Build](https://img.shields.io/badge/build-passing-brightgreen?style=flat)
|
7 | ![Build](https://img.shields.io/badge/tests-passing-brightgreen?style=flat)
|
8 | ![Version](https://img.shields.io/npm/v/@andypagdin/verify)
|
9 | ![Size](https://img.shields.io/bundlephobia/min/@andypagdin/verify)
|
10 |
|
11 | </div>
|
12 |
|
13 | Verify randomly generates a path for the user to follow using the on screen d-pad.
|
14 |
|
15 | ![PathGeneration](./docs/verify-demo1.gif) ![Demo](./docs/verify-demo2.gif)
|
16 |
|
17 | ## Installation
|
18 | Add `verify.js` to your project.
|
19 | ```html
|
20 | <script src="verify.js"></script>
|
21 | ```
|
22 | You can get the corresponding CDN link from [unpkg](https://unpkg.com/browse/@andypagdin/verify/).
|
23 |
|
24 | VerifyJs is available via [npm](https://www.npmjs.com/package/@andypagdin/verify).
|
25 | ```sh
|
26 | npm install @andypagdin/verify --save
|
27 | ```
|
28 |
|
29 | ## Usage
|
30 | Simply call `action()` to activate the verification modal.
|
31 | ```js
|
32 | Verify.action((result, message) => {
|
33 | console.log(result, message);
|
34 | });
|
35 | ```
|
36 | `result` will return 3 different codes:
|
37 |
|
38 | - `0`: Verify failed.
|
39 | - `1`: Verify successful.
|
40 | - `2`: Modal was closed before verification was able to complete.
|
41 |
|
42 | `message` will return 3 different strings:
|
43 |
|
44 | - `Incorrect move $move_direction`
|
45 | - `Verification successful`
|
46 | - `Modal closed before verification complete` |
\ | No newline at end of file |