Add Endpoint mapping, fix minor annoyances

 - Adds endpoint mapping from window.location.hostname for test and login
 - Prevents the brief flash of the default Salesforce page before we replace it
 - replaceWith() for some reason didn't add the body. Fixed by doing $html.html() instead