Extract loadScript from js file to view