Javascript optimization

This PR looks massive, but its not. I re-did all the history of my changes because my [test branch](https://github.com/DeuxHuitHuit/symphony-2/tree/collapsible) commit were not meaning full.

I played a lot with the js while attempting to fix some problems with @nilshoerrmann's datetime and I kind of set a bounty to myself to solve 6d70e19 (it took me like 10 hours to figure out and the fix is 4 chars...)

I also did a lot of timelining in the dev tools and regression testing.

Hope you like it... I really put lots of effort in it.
Following the conventions in the other files, there should be an empty line above the comment.