clean javascript and fix jquery preview