Header JavaScript: Make sure site_root_path is set when Bootstrap isn't enabled, and clean up duplicate code