Extended javascript to use underscore templating

Now generates a proper embed code and presents that in a custom modal
dialog.