Modify javascript templates

- wrap all templates in IIFE
- remove useless example boilerplate code