Modernizing inline script tags for templates & JS API

I moved it back to <head> for now.
I’m okay with the warning until it gets solved.
If it dies, it’s not the end of the world, it’s just a nice workaround for what I was really looking for.