Return to Snippet

Revision: 7606
at January 19, 2010 08:41 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 a=[];var t=T(f);if(t)a.push(t.replace(/^\s+|\s+$/g,''));for(var i=0;i<f.length;i++){a=a.concat(A(f[i]))}return a}var a=A(window.top);for(var i=0;i<a.length;i++){if(!/^https?:\/\//.test(a[i])) a[i]="http://"+a[i];window.open(a[i])}})();

//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 a = [];
		var t = T(f);
		if(t)
		{
			a.push(t.replace(/^\s+|\s+$/g, ''));
		}
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			a = a.concat(A(f[i]));
		}
		return a;
	}
	var a = A(window.top);
	for(var i=0; i<a.length; i++)
	{
		if(!/^https?:\/\//.test(a[i])) a[i] = "http://"+a[i];
		window.open(a[i]);
	}
})();

Revision: 7605
at September 2, 2008 08:16 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 a=[];var t=T(f);if(t)a.push(t.replace(/^\s+|\s+$/g,''));for(var i=0;i<f.length;i++){a.concat(A(f[i]))}return a}var a=A(window.top);for(var i=0;i<a.length;i++){if(!/^https?:\/\//.test(a[i])) a[i]="http://"+a[i];window.open(a[i])}})();

//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 a = [];
		var t = T(f);
		if(t)
		{
			a.push(t.replace(/^\s+|\s+$/g, ''));
		}
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			a.concat(A(f[i]));
		}
		return a;
	}
	var a = A(window.top);
	for(var i=0; i<a.length; i++)
	{
		if(!/^https?:\/\//.test(a[i])) a[i] = "http://"+a[i];
		window.open(a[i]);
	}
})();

Revision: 7604
at August 12, 2008 12:07 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 a=[];var t=T(f);if(t)a.push(t.replace(/^\s+|\s+$/g,''));for(var i=0;i<f.length;i++){a.concat(A(f[i]))}return a}var a=A(window.top);for(var i=0;i<a.length;i++){window.open(a[i])}})();

//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 a = [];
		var t = T(f);
		if(t)
		{
			a.push(t.replace(/^\s+|\s+$/g, ''));
		}
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			a.concat(A(f[i]));
		}
		return a;
	}
	var a = A(window.top);
	for(var i=0; i<a.length; i++)
	{
		window.open(a[i]);
	}
})();

Revision: 7603
at August 12, 2008 12:01 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 a = [];var t = T(f);if(t)a.push(t.replace(/^\s+|\s+$/g, ''));for(var i=0;i<f.length;i++){a.concat(A(f[i]))}return a}var a = A(window.top);for(var i=0;i<a.length;i++){window.open(a[i])}})();

//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 a = [];
		var t = T(f);
		if(t)
		{
			a.push(t.replace(/^\s+|\s+$/g, ''));
		}
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			a.concat(A(f[i]));
		}
		return a;
	}
	var a = A(window.top);
	for(var i=0; i<a.length; i++)
	{
		window.open(a[i]);
	}
})();

Revision: 7602
at July 31, 2008 09:38 by wizard04


Initial Code
javascript:(function(){function T(f){if(f.getSelection)return f.getSelection().toString();if(f.document.selection)return f.document.selection.createRange().text;return ''}function A(f){var a = [];var t = T(f);if(t){a.push(t.replace(/^\s+|\s+$/g, ''))}for(var i=0; i<f.length; i++){a.concat(A(f[i]))}return a}var a = A(window.top);for(var i=0; i<a.length; i++){window.open(a[i])}})();

//Here it is expanded so you can read it:
javascript:(function(){
	function T(f)	//get the selected text in frame f
	{
		if(f.getSelection) return f.getSelection().toString();
		if(f.document.selection) return f.document.selection.createRange().text;
		return '';
	}
	function A(f)	//get the selected text in frame f and its children
	{
		var a = [];
		var t = T(f);
		if(t)
		{
			a.push(t.replace(/^\s+|\s+$/g, ''));
		}
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			a.concat(A(f[i]));
		}
		return a;
	}
	var a = A(window.top);
	for(var i=0; i<a.length; i++)
	{
		window.open(a[i]);
	}
})();

Initial URL


Initial Description
When there's a URL on a page that's not a link, just highlight it and click this bookmarklet. The URL will open in a new window.

If there are multiple selections (e.g., if you've selected something in each of two frames on the page), they will each be opened in a new window.

[Open Link](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 a=[];var t=T(f);if(t)a.push(t.replace(/^\s+|\s+$/g,""));for(var i=0;i&lt;f.length;i++){a=a.concat(A(f[i]))}return a}var a=A(window.top);for(var i=0;i&lt;a.length;i++){if(!/^https?:\/\//.test(a[i])) a[i]="http://"+a[i];window.open(a[i])}})() "Drag this into your bookmarks!")

Initial Title
Open Selected Link Bookmarklet

Initial Tags
javascript

Initial Language
JavaScript