Refactor view

`view.js` is one of the last few remaining files that have a [red F on Code Climate](https://codeclimate.com/github/remotestorage/remotestorage.js/src/view.js).

This PR refactors most of the big issues mentioned on Code Climate.