Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.