Extract JavaScript to own file