Made peace with JSHint

1. Used a function maker to void making “functions in loops”
2. Added JSHint directives to turn off undefined errors on all app- and
package-scoped variables.