Return to Snippet

Revision: 8189
at July 15, 2011 23:26 by wizard04


Updated Code
javascript:(function(){function T(f){try{if(f.getSelection)return f.getSelection().toString();if(f.document.selection)return f.document.selection.createRange().text}catch(e){}return ''}function A(f){var t=T(f);if(t)return t;for(var i=0;i<f.length;i++){t=A(f[i]);if(t) return t}return ''}var a=encodeURIComponent(A(window.top).replace(/[
]+/g,", ").replace(/\s+/g," "));if(a)window.open("http://maps.google.com/maps?q="+a)})();

//Here it is expanded so you can read it:
javascript:(function(){
	function T(f)	//get the selected text in frame f
	{
		try{
			if(f.getSelection) return f.getSelection().toString();
			if(f.document.selection) return f.document.selection.createRange().text;
		}catch(e){}	//if the frame is in another domain
		return '';
	}
	function A(f)	//get the selected text in frame f and its children
	{
		var t = T(f);
		if(t) return t;
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			t = A(f[i]);
			if(t) return t;
		}
		return '';
	}
	var a = encodeURIComponent(A(window.top).replace(/[
]+/g, ", ").replace(/\s+/g, " "));
	if(a) window.open("http://maps.google.com/maps?q="+a);
})();

Revision: 8188
at July 15, 2011 23:23 by wizard04


Updated Code
javascript:(function(){function T(f){try{if(f.getSelection)return f.getSelection().toString();if(f.document.selection)return f.document.selection.createRange().text}catch(e){}return ''}function A(f){var t=T(f);if(t)return t;for(var i=0;i<f.length;i++){t=A(f[i]);if(t) return t}return ''}var a=encodeURIComponent(A(window.top).replace(/\n+/g,", ").replace(/\s+/g," "));if(a)window.open("http://maps.google.com/maps?q="+a)})();

//Here it is expanded so you can read it:
javascript:(function(){
	function T(f)	//get the selected text in frame f
	{
		try{
			if(f.getSelection) return f.getSelection().toString();
			if(f.document.selection) return f.document.selection.createRange().text;
		}catch(e){}	//if the frame is in another domain
		return '';
	}
	function A(f)	//get the selected text in frame f and its children
	{
		var t = T(f);
		if(t) return t;
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			t = A(f[i]);
			if(t) return t;
		}
		return '';
	}
	var a = encodeURIComponent(A(window.top).replace(/\n+/g, ", ").replace(/\s+/g, " "));
	if(a) window.open("http://maps.google.com/maps?q="+a);
})();

Revision: 8187
at March 22, 2009 21:46 by wizard04


Updated Code
javascript:(function(){function T(f){try{if(f.getSelection)return f.getSelection().toString();if(f.document.selection)return f.document.selection.createRange().text}catch(e){}return ''}function A(f){var t=T(f);if(t)return t;for(var i=0;i<f.length;i++){t=A(f[i]);if(t) return t}return ''}var a=A(window.top).replace(/[
]+/g,", ").replace(/\s+/g," ");if(a)window.open("http://maps.google.com/maps?q="+a)})();

//Here it is expanded so you can read it:
javascript:(function(){
	function T(f)	//get the selected text in frame f
	{
		try{
			if(f.getSelection) return f.getSelection().toString();
			if(f.document.selection) return f.document.selection.createRange().text;
		}catch(e){}	//if the frame is in another domain
		return '';
	}
	function A(f)	//get the selected text in frame f and its children
	{
		var t = T(f);
		if(t) return t;
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			t = A(f[i]);
			if(t) return t;
		}
		return '';
	}
	var a = A(window.top).replace(/[
]+/g, ", ").replace(/\s+/g, " ");
	if(a) window.open("http://maps.google.com/maps?q="+a);
})();

Revision: 8186
at September 5, 2008 16:11 by wizard04


Initial Code
javascript:(function(){function T(f){try{if(f.getSelection)return f.getSelection().toString();if(f.document.selection)return f.document.selection.createRange().text}catch(e){}return ''}function A(f){var t=T(f);if(t)return t;for(var i=0;i<f.length;i++){t=A(f[i]);if(t) return t}return ''}var a=A(window.top).replace(/\s+/, " ");if(a)window.open("http://maps.google.com/maps?q="+a)})();

//Here it is expanded so you can read it:
javascript:(function(){
	function T(f)	//get the selected text in frame f
	{
		try{
			if(f.getSelection) return f.getSelection().toString();
			if(f.document.selection) return f.document.selection.createRange().text;
		}catch(e){}	//if the frame is in another domain
		return '';
	}
	function A(f)	//get the selected text in frame f and its children
	{
		var t = T(f);
		if(t) return t;
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			t = A(f[i]);
			if(t) return t;
		}
		return '';
	}
	var a = A(window.top).replace(/\s+/, " ");
	if(a) window.open("http://maps.google.com/maps?q="+a);
})();

Initial URL

                                

Initial Description
Highlight an address and click the bookmarklet to open it in Google Maps

Initial Title
Google Map It Bookmarklet

Initial Tags
javascript

Initial Language
JavaScript