This has not DOM ready event, it does not even wait for jQuery to load. This Kind of declaration is bad practice, and can result in a very bad way. 
Saying that I can understand why you did it, for that reason I think we can sit down and talk a bit about javascript. Not that I know a whole lot of it, but what I know I can tell.
If you wish, here is some reading material on javascript, (I find it very good) and I am referencing you to the module pattern part of it, which is relevant for the implementation of our javascript.

For now leave this as is, we will make sense of it today at meetup.