add umd amdWebGlobal pattern, jshint fixes

amdWebGlobal https://github.com/umdjs/umd/blob/master/amdWebGlobal.js
allows to use a js module as an amd module (like require.js) and as a simple js file (via
script tag).

jshint fixes regarding whitespace at end of lines, coding style and var
hoisting.

I kept the windows style endlines (\r\n) since it was already like that