moving the js for view definitions into separate files

This way we get syntax highlighting and so on.