Update directive.js

Handle both types of location formats.