abidibo.net

wordevents

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.

Requirements

It requires

  • mootools core >= 1.4.5

Actually it requires only some parts of it, the selector engine, the Options Mixin and the Events functions.

Features

Some options available:

target
the element to which the event listener is attached, default the document element
digit_interval
The time interval between two typed characters in order to be considered belonging to the same word, default 500ms
event_type
The keyboard event type, default 'keyup'
acceptedCode
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:

  • windows:
    - google chrome
    - firefox
    - internet explorer 9.0
  • linux:
    - chromium
    - firefox
  • mac:
    - firefox
    - safari

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.

mootools forge documentation demo download