ninoM said almost 8 years ago on Page Specific Javascript in Ruby on Rails :

Thanks for providing the JS equivalent code!