Port frontend JavaScript code to Go.

This is a work in progress.
This doesn't quite work, see discussion at gopherjs/gopherjs#98.