Rework javascript and use coffeescript with jQuery