What's all that JavaScript code for?

Asked by Tiefflieger

Because of Bug #340058 I wanted to have a look inside of launchpad. So I downloaded launchpad.js and ran the auto-format command of NetBeans.
I ended up with almost 12.000 lines of code.
That's a lot more than I'd expected. Ok, there's the shiny small ajax functions here and there, but no 3D-Drag&Drop-Windows rendered by JavaScript, so what's all this code for?
Don't get me wrong, I think that this JavaScript does a good Job since I don't notice it does. I'm just curious :-)

My own explanations so far:
- I just don't recognize JS when I see it in action
- Launchpad uses JS code copied from many other free resources and stores them for caching purposes in one single file
- JS Code is obfuscated, not necessarily by Launchpad, but by others, see previous point (what other reasons could be for functions like "add:function(a,b){return a+b;}"?)

Again, I'm just curious, I'm not blaming anybody for anything :-)

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Francis J. Lacoste
Solved:
Last query:
Last reply:
Revision history for this message
Best Francis J. Lacoste (flacoste) said :
#1

Most of the code you are seeing is YUI3 (Yahoo User Interface library) which is indeed obfuscated and inlined into a single JS file in order to maximize caching and reduce problems with multiple connections for high-latency links.

So you guessed right for most of these.

Revision history for this message
Tiefflieger (tiefflieger) said :
#2

Thanks Francis J. Lacoste, that solved my question.