Created
June 28, 2010 12:25
-
-
Save thinkphp/455776 to your computer and use it in GitHub Desktop.
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(){ | |
| 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