JS lint: remove trailing commas and fix other minor browser compatibility issues.