Fix AMD Support, more robust

Hello,

here is the fix for asynchronous module loaders, this time hardened and not broken by a bunch of comment tags. ;)
I've tried using cheerio but it really slowed things down up to the point of failing the test so I went with the approach of inserting the snippets before **any** line containing a script tag, even if commented out.

Hope this helps! (Fix for #2)