Templatized the custom JavaScript code

This should allow to inject URLs in the code using the Django url template tag