Extended $1 Unistroke Recognizer (JavaScript version)