move JavaScript code out of makefile