This is a mootools plugin which allows to listen for word typed events, and execute given callbacks if the word belongs to a given dictionary. Dictionary can be populated with words or regular expressions. Instead of listening for single chars, wordevents can listen for words (a word is considered to be a set of characters typed with a time interval minor than the digit_interval option). Callbacks functions are called passing the list of events which formed the word, the word itself and binded to the target element.
- mootools core >= 1.4.5
Actually it requires only some parts of it, the selector engine, the Options Mixin and the Events functions.
Some options available:
- the element to which the event listener is attached, default the document element
- The time interval between two typed characters in order to be considered belonging to the same word, default 500ms
- The keyboard event type, default 'keyup'
- a function used to check if the pressed key has to be considered or not. It takes the argument evt which is the event object and must return true or false.
wordevents has been tested with:
- google chrome
- internet explorer 9.0
If you find errors, bugs or simply have some annotations or advises, please comment here or submit them to the project page hosted on github.