-
-
Save holin/61331 to your computer and use it in GitHub Desktop.
This file contains 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
CmdUtils.CreateCommand({ | |
name: "map-me", | |
_getMapUrl: function() { | |
var loc = CmdUtils.getGeoLocation(); | |
var mapUrl = "http://maps.google.com/staticmap?"; | |
var params = { | |
center: loc.lat + "," + loc.long, | |
size: "500x400", | |
zoom: 14, | |
key: "ABQIAAAAGZ11mh1LzgQ8-8LRW3wEShQeSuJunOpTb3RsLsk00-MAdzxmXhQoiCd940lo0KlfQM5PeNYEPLW-3w" | |
}; | |
return mapUrl + jQuery.param( params ); | |
}, | |
preview: function( pblock ) { | |
var msg = "Inserts a map of your current location: <br/>"; | |
msg += "<img src='%s'/>".replace( /%s/, this._getMapUrl() ); | |
pblock.innerHTML = msg; | |
}, | |
execute: function( ) { | |
CmdUtils.getImageSnapshot( this._getMapUrl(), function(imgData) { | |
CmdUtils.setSelection( "<img src='" + imgData +"'/>"); | |
}) | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment