moving jsapi source into template