make external js file out of inline script