Move the script to js file