A few chmgen fixes

* Fix JS paths
* Work around mainPage JS bug
* Compilation (deprecation, property) fixes
* Whitespace