port all JS sources to requirejs

This introduces requirejs in order to make all the code more modular. This can serve as a starting point to restructure the project towards a more clean JS application.

This is the minimal amount of changes to introduce requirejs, but it basically changes every single line of JavaScript. So before merging this, please make sure only very simple PR are still left open, because this will break patches done against an older base. However, I see this as an essential step of refactoring and like to see it merged rather sooner than later.

I will also open another request, soon, that I will base on this commit, but having this one in, would make merging more easy, later.