Lots of JS changes.

* Major refactoring.
* Objects.
* Wavesurfer caching.