split 10,000 lines of client-side JavaScript into multiple files

issue #226