Skip to content

Instantly share code, notes, and snippets.

@sansumbrella
Created April 5, 2010 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sansumbrella/355866 to your computer and use it in GitHub Desktop.
Save sansumbrella/355866 to your computer and use it in GitHub Desktop.
Find in Maps bookmarklet
/*
Find in Maps Bookmarklet
author: @sansumbrella
Enters the selected query into Google Maps.
Maps is generally location-aware, so it should pick out your city for use
*/
(function() {
var p;
function init(){
var selected;
var mapsUrl = 'http://maps.google.com/maps?iwloc=A&hl=en&q=';
if (window.getSelection) {
selected = window.getSelection();
} else if (document.selection) {
selected = document.selection.createRange();
}
var address = "";
if(selected.toString()!="") {
address = selected.toString();
} else {
address = escape( prompt('Enter Street Address:','') );
}
document.location.href= mapsUrl + address;
}
init();
})();
javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','http://www.sansumbrella.com/things/bookmarklets/find/find.js?'+new%20Date());document.body.appendChild(e)})())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment