Fix typo in gitignore and refactor js