I think we should provide a better architecture for the JS code. Using a pattern like AMD/RequireJS could be very helpful here, specially to avoid repeating code in each file, and to isolate functionality since we don't really have namespaces on JS. Please investigate.