Fix the coding style in the orientation ext JavaScript

Fix valid cases pointed out by JSLint and avoid using
deprecated JavaScript methods.
Merge pull request #1516 from kenchris/style

Fix the coding style in the orientation ext JavaScript