Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created June 28, 2010 12:25
Show Gist options
  • Select an option

  • Save thinkphp/455776 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/455776 to your computer and use it in GitHub Desktop.
function(){
new MooGeo('ipvisitor',{
onSuccess: function(o){
var info = $('info');
var ob = o.ip;
if(window.console){console.log('IP: '+ob);}
document.id('info').set('text','Your IP is: '+ob);
new MooGeo(o.ip,{
onComplete: function(o) {
var lat = o.place.centroid.latitude, lon = o.place.centroid.longitude, name = o.place.name;
var url = 'http://maps.google.com/maps/api/staticmap?center='+
lat+','+lon+'&sensor=false&size=300x300&maptype=roadmap&key='+
'ABQIAAAAHFKkG2s1GKwMWvhsxH6UGhTsE91L0UkYXwp_YlL0uSAPtCVs5hTWKxoV6BCF8F8RGtpqa4IYPMkbcQ'+
'&markers=color:blue|label:I|'+lat+','+lon+'&visible='+lat+','+lon+'|'+(lat+1)+','+(lon+1);
var map = $('map');
map.set('html','<img src="'+url+'" alt="'+name+'">');
}
});
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment