Add-on to exclude domains from right-click?

User avatar
Hey Jude
5StarLounger
Posts: 1015
Joined: 24 Jan 2010, 15:45
Location: Ohio, U.S.A.

Re: Add-on to exclude domains from right-click?

Post by Hey Jude »

Thanks for the great explanation Hans :-) I will experiment a little bit with this.
♫...Take a sad song and make it better . . .♫ Image

User avatar
Hey Jude
5StarLounger
Posts: 1015
Joined: 24 Jan 2010, 15:45
Location: Ohio, U.S.A.

Re: Add-on to exclude domains from right-click?

Post by Hey Jude »

ChrisGreaves wrote: Select some text in your browser pane, a half-dozen words or so.
Then click on Andy's button.
The button-script should spring into life, obtain the search text from your previous selection, and drop it right into the search box.
It was nagging me that I hadn't accomplished this aspect, but now this works!! I didn't understand where you got "text" from so have tried it several times (I copied "ChrisGreaves wrote") and bingo! This is very cool. Now I'm happy with the results :grin:
Text plus My Google results.png
You do not have the required permissions to view the files attached to this post.
♫...Take a sad song and make it better . . .♫ Image

User avatar
Sundog
5StarLounger
Posts: 704
Joined: 28 Jan 2010, 22:47
Location: Alien Country (Roswell NM)

Re: Add-on to exclude domains from right-click?

Post by Sundog »

HansV wrote:You can replace experts-exchange.com with any URL of a site that you don't want to see in your search results.
Does this mean that each excluded site should be added to the script? If so, how would the string

Code: Select all

window.open("http://www.google.com/search?q=" + escape(q).replace(/ /g, "+")+" -site:experts-exchange.com")
be modified? Is there some way to automate this?
Sundog

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Add-on to exclude domains from right-click?

Post by agibsonsw »

You can amend " -site:experts-exchange.com" to " -site:experts-exchange.com -site:dodgy.com -site:another.com" (with a space between each site).
You can omit the minus sign if you wish to search for results from a particular web site. You can also enter part of a domain - such as "-site:.dn" (I believe). Is that Denmark or Germany?

You will still have to go through the sequence of editing it first in Notepad. You could 'probably' automate it to pop up with a second box requesting which site to omit,
but wouldn't that defeat the purpose? Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
Hey Jude
5StarLounger
Posts: 1015
Joined: 24 Jan 2010, 15:45
Location: Ohio, U.S.A.

Re: Add-on to exclude domains from right-click?

Post by Hey Jude »

Is there a way to replace the regular "Google" search engine code with this one so it showed up in the drop down list of Search engines?

Having a customized search with Andy's name on it--well I guess it doesn't get any better than that :cheers:
Last edited by Hey Jude on 12 Jan 2011, 18:34, edited 1 time in total.
♫...Take a sad song and make it better . . .♫ Image

User avatar
Sundog
5StarLounger
Posts: 704
Joined: 28 Jan 2010, 22:47
Location: Alien Country (Roswell NM)

Re: Add-on to exclude domains from right-click?

Post by Sundog »

Thanks for the response!
You could 'probably' automate it
By "automate," I'm thinking like a button "Add URL to Exclude List" that would grab the URL off the Clipboard (after you copied it--not automated, darn), open Notepad, append the URL to the right place in the script, Save the new script, append it to Andy's Button (and get me another cold :belgium:-style Blue Moon from the fridge).
Sundog

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Add-on to exclude domains from right-click?

Post by agibsonsw »

It's technically possible to automate anything, even getting your beer for you!

If you have kept the .html file you could copy this part of it:

javascript:q = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt("You didn't select any text. Enter a search phrase:", ""); if (q!=null) window.open("http://www.google.com/search?q=" + escape(q).replace(/ /g, "+")+" -site:experts-exchange.com"); void 0

Create a new Bookmark and paste your edited version of it into the Location box (in FireFox).

This is not automation but might make it easier to create new versions of the bookmark.

There might be a way to edit an existing bookmark, but my FireFox/Organize Bookmarks... dialog is empty, so I'm not sure.
You do not have the required permissions to view the files attached to this post.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Add-on to exclude domains from right-click?

Post by agibsonsw »

Hey Jude wrote:Is there a way to replace the regular "Google" search engine code with this one so it showed up in the drop down list of Search engines?

Having a customized search with Andy's name on it--well I guess it doesn't get any better than that :cheers:
I'm honoured! But I think this might be a step too far :sad:
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
Sundog
5StarLounger
Posts: 704
Joined: 28 Jan 2010, 22:47
Location: Alien Country (Roswell NM)

Re: Add-on to exclude domains from right-click?

Post by Sundog »

agibsonsw wrote:There might be a way to edit an existing bookmark
Edit an existing bookmark by right-clicking it and select Properties. Here's what I put in the Description box for "Andy's Button:"

To add a new URL to exclude: Copy the new URL and paste it after "%20-site:experts-exchange.com" in Location box above. prefixing it with "%20-". E.g., "%20-site:experts-exchange.com%20-NewURL.domain". Then click Save. Your button will now exclude that additional URL from a search.
Sundog

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add-on to exclude domains from right-click?

Post by HansV »

agibsonsw wrote:such as "-site:.dn" (I believe). Is that Denmark or Germany?
Neither - .dn doesn't exist.
The top-level domain for Germany is .de and that for Denmark is .dk.
Best wishes,
Hans

User avatar
jscher2000
2StarLounger
Posts: 148
Joined: 26 Dec 2010, 18:17

Re: Add-on to exclude domains from right-click?

Post by jscher2000 »

Hey Jude wrote:Is there a way to replace the regular "Google" search engine code with this one so it showed up in the drop down list of Search engines?
Search engine plugins can be customized. This form creates plugins and has a link to the more detailed documentation: http://mycroft.mozdev.org/submitos.html" onclick="window.open(this.href);return false;

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15636
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Add-on to exclude domains from right-click?

Post by ChrisGreaves »

Hey Jude wrote:Having a customized search with Andy's name on it
Might I suggest 'andy ?
There's nothing heavier than an empty water bottle

User avatar
Hey Jude
5StarLounger
Posts: 1015
Joined: 24 Jan 2010, 15:45
Location: Ohio, U.S.A.

Re: Add-on to exclude domains from right-click?

Post by Hey Jude »

ChrisGreaves wrote:
Hey Jude wrote:Having a customized search with Andy's name on it
Might I suggest 'andy ?
I have fooled around quite a bit with these search engine codes since this topic was introduced. I modified the plain Google search to include a box which will search only the website as opposed to Google at-large. That just means I created Google search engines for several of my friends' websites which also includes a box
Google indiviualized search.png
If the box is unchecked, it defaults to searching all of Google. My question was how to functionalize 'andy and add it to my drop-down list of search engines--even though it is easily executed thru the bookmark toolbar.

Taking it a step farther, I wished to add Eileen's Lounge search engine to my list as well. On some sites, you can automatically add them by clicking the down arrow on the search bar and you're given the option of adding a certain site to the list.

Perhaps this belongs in another thread now as well.
You do not have the required permissions to view the files attached to this post.
♫...Take a sad song and make it better . . .♫ Image

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Add-on to exclude domains from right-click?

Post by agibsonsw »

someone might be interested in the attached HTML page which can hopefully be easily modified.
go_search.png

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Andy's Search Page</title>
<script type="text/javascript">
	function Go()
	{
		var sText;
		var sSites = "";
		sText = document.getElementById("searchText").value;
		if ( sText != "")
		{
			if (document.getElementById("ee").checked)
				sSites += " -site:experts-exchange.com";
			if (document.getElementById("br").checked)
				sSites += " -site:bigresource.com";
			window.open("http://www.google.com/search?q=" + escape(sText).replace(/ /g,"+") + sSites);
		}
		else
		{
			window.alert('You must enter something into the search box!');
			document.getElementById("searchText").focus();
		}
	}
</script>
</head>
<body>

<form id="myForm" action="">
<input type="text" id="searchText" />
<button type="button" onclick="Go()">Go Search</button>
<p>Choose sites to exclude:</p>
<p><input type="checkbox" id="ee" checked="checked" value="true" />Experts Exchange</p>
<p><input type="checkbox" id="br" checked="checked" value="true" />Big Resource</p>
</form>
</body>
</html>
You do not have the required permissions to view the files attached to this post.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
Hey Jude
5StarLounger
Posts: 1015
Joined: 24 Jan 2010, 15:45
Location: Ohio, U.S.A.

Re: Add-on to exclude domains from right-click?

Post by Hey Jude »

Thank you!!!
♫...Take a sad song and make it better . . .♫ Image

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Add-on to exclude domains from right-click?

Post by agibsonsw »

Because this is no longer running as a 'Bookmarklet' the complicated escape,replace combination may no longer be necessary, but I've left it in for the mo. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Add-on to exclude domains from right-click?

Post by agibsonsw »

I'm on a roll..
go_search2.png

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Andy's Search Page</title>
<script type="text/javascript">
	function Go()
	{
		var sText;
		var sSites = "";
		sText = document.getElementById("searchText").value;
		if ( sText != "")
		{
			if (document.getElementById("ee").checked)
				sSites += " -site:experts-exchange.com";
			if (document.getElementById("br").checked)
				sSites += " -site:bigresource.com";
			if (document.getElementById("other").checked && document.getElementById("otherT").value != "")
				sSites += " -site:" + document.getElementById("otherT").value;
			// window.open("http://www.google.com/search?q=" + escape(sText).replace(/ /g,"+") + sSites);
			window.open("http://www.google.com/search?q=" + sText + sSites);
		}
		else
		{
			window.alert('You must enter something into the search box!');
			document.getElementById("searchText").focus();
		}
	}
</script>
</head>
<body>

<h1>Andy's Search </h1>
<form id="myForm" action="">
<input type="text" id="searchText" />
<button type="button" onclick="Go()">Go Search</button>
<p>Choose sites to exclude:</p>
<p><input type="checkbox" id="ee" checked="checked" value="true" />Experts Exchange</p>
<p><input type="checkbox" id="br" checked="checked" value="true" />Big Resource</p>
<p><input type="checkbox" id="other" checked="checked" value="true" />
<input type="text" id="otherT" />&nbsp;&nbsp;(Type another site or domain)</p>

</form>
</body>
</html>
You do not have the required permissions to view the files attached to this post.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
Hey Jude
5StarLounger
Posts: 1015
Joined: 24 Jan 2010, 15:45
Location: Ohio, U.S.A.

Re: Add-on to exclude domains from right-click?

Post by Hey Jude »

I'm learning from looking at your code and modifying it. You are a whiz!!
♫...Take a sad song and make it better . . .♫ Image

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15636
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Add-on to exclude domains from right-click?

Post by ChrisGreaves »

agibsonsw wrote:I'm on a roll..
Andy.
Stop!
You are freaking me out, and I'm on a cabbage roll!
There's nothing heavier than an empty water bottle

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15636
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Add-on to exclude domains from right-click?

Post by ChrisGreaves »

agibsonsw wrote:<form id="myForm" action="">
<input type="text" id="searchText" />
<button type="button" onclick="Go()">Go Search</button>[/code]
Might I humbly suggest:
<input type="text" id="searchText" size="100" />
There's nothing heavier than an empty water bottle