Extract js from html to main.js