Rewrite of dependencies.js

The original code wasn't very optimized (8+ document.write calls!), so I rewrote it to be a little more performant.
Now I get an execution time of about 0.05ms, compared to 0.5ms before.

I just dived into Brackets' codebase, with the intention of optimizing some code (Brackets still feels a little slow), and this was an easy first pick.