Port frontend JavaScript code to Go.

This is a work in progress.