JS: Factor out existing use of base URL.
JS: Use base URL everywhere to build absolute URLs instead of using relative URLs.