You can also be interested in:
Wordevents is a mootools plugin which allows to listen for word typed events, and execute given callbacks if the word belongs to a given dictionary. Till release 0.1.x it the dictionary could be only filled with strings, which represent the words to listen for. Now things are different.
Wordevents accepts as an option a function which says if the typed character should be considered or not, allowing to consider only a certain set of characters (i.e. numbers or alphanumerical characters). Till release 0.1.x such function received as a parameter the pressed key code in order to decide whether to accept it or not.
With release 0.2.x such function receives the entire event object allowing to use other information in its logic. For example now you can disable listening when typing inside an input element or a textarea, by checking the
But the main new feature is the ability to populate the dictionary with regular expressions. So that it is possible to listen to a set of words and execute a common callback which receives the array of events and the typed word.
I've used this new feature to implement a search functionality. When typing /word (love vim) the word word is set to be the value of a text search field and the form submitted. Notice that for FF in this case I've had to set up a regular expression for italian keyboard layout, so that typing / equals to type a 7 char with the shift key pressed.
So my regular expression was
/^7[a-z]*/ and in the callback function I've checked for the shift key to be pressed in the first event.
Chrome instead detects the / character.
You may find the updated demo page here. Good coding!