Two compatibility fixes

- Use ```$(document.body)``` everywhere instead of ```$('body')``` because the latter will select ```<body>``` elements within SVG ```<foreignobject>``` elements, which is never what you want.

- Don't assume the environment variables are defined at import time. Default to acting like the developer/testing environment if the production environment is not found.