JS cleanup

**Please test thoroughly**

This is an attempt to clean up our javascript files and make them comply with the WordPress Coding Standards.

See http://make.wordpress.org/core/handbook/coding-standards/javascript/.