Fixing the complains by jshint

In the previous commit I deactivated the option of using `jshint` to
review the javascript code because it was throwing an error that
couldn’t explain despite I was following style guides.

But after checking with the community, the problem is easily solved by
defining the functions before they are used (i.e., what `jshint` was
complaining about!).

I also made “angular”: true in the “global” variables definitions
following advices.