added CORS support to directives.js