refactoring js files from base.html