Created
May 21, 2013 23:56
-
-
Save PirosB3/5624258 to your computer and use it in GitHub Desktop.
GeoHackr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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