Created
April 5, 2010 01:01
-
-
Save sansumbrella/355866 to your computer and use it in GitHub Desktop.
Find in Maps bookmarklet
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
/* | |
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(); | |
})(); |
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
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