Fixes JENKINS-23282: support delivery pipeline view as the default view

The XHR calls to the delivery pipeline view api do not work
when the view is the default view; this is due to the use of
'api/json' as the api url.  The root level
`http://server/[JenkinsRootUrl]/api/json` URL is reserved
for the JSON API for jobs entities.

This patch forces the XHR calls to use the absolute URL to
the JSON API for the pipeline view, regarldess of
the request URL.

Also includes small reorganization of the embedded Javascript in
main.jelly for readability and eventual use of closures for
best practice variable scoping.