client refactor view-mgr.js