Refactors geolocation functionality

Refactors geolocation to generalize the geolocation button script so it
can be shared more easily between the homepage and inside pages, and
anywhere else it may be needed.