excelerondesign / whc

0 stars 0 forks source link

About

WeHateCaptchas is a form verification service created by Edward Dalton, now maintained by Cohan Robinson designed to "timeout" bots, rather than out think them. Examples here: HTML, PHP

Here we've altered the Javascript aspect from the example to add some extra benefits.

Documentation

To include in a project, upload or copy dist/whc-plugin.umd.js to your project, and add the necessary parameters below.

If you only need to support more modern browsers, you can use the js inside of dist/whc-plugin.modern.js

Parameters

HTMLScriptElement

id = whcScriptTag required

use getElementsByClassName data-form a class name for the forms on the page.

data-button a class name for the submit buttons/inputs on the page.


HTMLFormElement

data-debug: A boolean for getting more information about what is going on behind the scenes. Accepted values are any Integer, 'true' or 'false', ''.

While you can use 'false', it is an anti-pattern and should be avoided in production.

HTMLButtonElement or HTMLInputElement

data-difficulty: A number between 1 - 10. Determines the number of "questions" to answer before marking the user as verified.

data-finished: The text/value of the element after verified.

Automatic data attributes

data-progress: Visual representation of the verification progress

Internal Variables

Private.time The time the verification starts Private.script The script element Private.form Current form Private.button Current submit button Private.difficulty The difficulty of the verification process, either the default (5), the data-difficulty of the only button/input on the page, or an average of all on the page. Private.eventName Internal event name for debugging Private.workerFunc Inline WebWorker function Private.worker The WebWorker after it is creater Private.debug A function that checks all the forms for a debug value, turns on extra debugging features if true

Globals

To limit Global variables, if Private.debug is true, it will add window.WHCDetails with an object including all the forms, buttons, and the current difficulty.