More scripting

Adds support for capturing keyboard, mouse, touch and wheel events in javascript.

Depends on #1724

Closes #1705, closes #1706