Skip to content

Instantly share code, notes, and snippets.

@PirosB3
Created May 21, 2013 23:56
Show Gist options
  • Save PirosB3/5624258 to your computer and use it in GitHub Desktop.
Save PirosB3/5624258 to your computer and use it in GitHub Desktop.
GeoHackr
(function() {
var TITLE_TEXT = 'Hey Cheater, here is your address :)'
var geocoder = new google.maps.Geocoder();
var getCurrentRound = function() {
if (!gg.GuessRoundCollection) return null;
var res = gg.GuessRoundCollection.filter(function(e) { return !e.guessLatLng });
return res.length == 1 ? res[0] : null;
};
var getGeocodedResults = function(coords, callback) {
var latlng = new google.maps.LatLng(coords.lat, coords.lng);
geocoder.geocode({ latLng: latlng }, function(results, status) {
return callback(results, status === 'OK');
});
};
var round = getCurrentRound();
var latLng = getCurrentRound().latLng
getGeocodedResults({ lat: latLng.jb, lng: latLng.kb }, function(res, success) {
if (!success) return alert('FAIL');
window.prompt(TITLE_TEXT, res[0].formatted_address);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment