Fix some bugs so this actually works.

There was a problem with relative URLs (no surprise).
Also add a comment before each inlined script, in case that proves
to be meaninful somewhere...