Refactors JavaScript module structure

Organizes JS modules into directories and creates required scripts for
loading sets of modules (i.e. app, search, details).