code refactor and jquery turbolinks added

i have reduced javascript code and also i added jquery turbolinks