<< Previous BlogNext Blog >>

Greasemonkey Script to Locate Multiple Domains in Search Results

Greasemonkey is a Firefox Add-on that can be used to install custom scripts that run on specific pages on the internet when the page loads. This can be a very useful tool for many things such as highlighting elements, hiding elements and adding custom functionality to pages that weren't previously available.

One useful tool I have seen is written by Mark Stoecker actually highlights listing on a search results page from the big three search engines (Google, Yahoo! and Bing) based on the domain you ask it to show.

The biggest flaw with this script is that you can only manage one domain at a time so you'd either have to install multiple scripts for each domain, or change the script each time you searched for a separate domain.

I decided to write an addition to this extension, which allows for multiple domains and for each domain you can select a different colour to highlight so that you can differentiate between which domain you are referring to on a single page by the different colours of their backgrounds.

The syntax for setting up your domains is:

var sites = [['domain1.com', '#FCC'], ['domain2.com', '#F00']];

Basically, for each site you have list the domain name of the site, and then the colour in exactly the same way that this one has been done for two domains. Each one must be surrounded by square braces (']' and ']') and the whole list must also be surrounded by square braces.

Once all that has been edited all you need to do is install the script into Greasemonkey and run it in a search.

Multiple Domain Highlights in Search Engine

Any questions/bug reports/fixes/update you need or see please let me know in the comments to this blog, or you can find my script on Userscripts.org where you can leave feedback and bug reports.

Otherwise, enjoy the script! If you have Greasemonkey already installed click here otherwise the source can be found here. I would like to thank Lee Johnson for notifying me of the script and asking me to write it for him!

Update: If you would like an enhanced (beta) version of the script you can download it here or find the source here and just copy the source over what you already have (but don't forget to re-update your domains!). This update shows you the listing number in Google (or what position the domain appears in. Keep checking back for updates as this script is now a constant work in progress!

Once again, let me know if there are any issues.

2105tweet
1
Excellent
0
Very Good
0
Average
0
Below Average
0
Poor

Article Info

  • Posted By: Alex Hall
  • On: 18th Aug 2009 @ 13:21:23
  • Comments: 5
  • Rating: 5 / 5
  • Hits: 2105
  • Listed In:
  • Short URL: http://bit.ly/1PlFWT

About the author

Alex is a web developer currently working for Worldview Limited in Morecambe, UK. Alex likes to write code and is proficient in HTML, CSS, PHP, JavaScript, Ajax, XML and XSLT. In his spare time Alex likes to write articles and scripts for various projects.

Share This Article

  • Author: ju

    #1 | 18th Aug 09 @ 16:05

    Hi,

    it seems Google changed urls and your script is not working anymore can you help ?

    Br

    reply

  • Author: Mark Stoecker

    #2 | 18th Aug 09 @ 17:41

    Alex, Very nice update. I planned on doing this myself, but have so much going in it got pushed to the back burner. I'm still getting quite a few installs from my script and I've updated it (locally and on UserScripts.org) with the changes you've made. Thanks again.

    reply

  • Author: Alex Hall

    #3 | 18th Aug 09 @ 18:34

    Thanks Mark, though I have to say it's your script, I just modified it! So thanks to your for doing the leg work! I've just added an update to fix a couple of style issues and I've created a new script with extra functionality that displays the listing number as well as highlighting the listing. I'll add a link to this in the post above.

    @ju: could you try updating the script now as I've added some updates and let me know your search terms, domains, colours and what you see and I'll see if I can find a fix for you if the update doesn't work

    reply

  • Author: Alan Bleiweiss

    #4 | 16th Nov 09 @ 18:42

    Alex, This was working great for a while. Then it wouldn't work intermittently - when I messed with deactivating various other FF plug-ins, I could get it to work sometimes. Out of frustration I uninstalled Greasemonkey, reinstalled fresh with the latest version, and just installed your latest version of this script. No go. Help!

    I am running FF 3.08 on Windows Vista on my P.C.

    Alan

    reply

  • Author: Alex Hall

    #5 | 19th Dec 09 @ 23:46

    Hi Alan,

    I apologise for the late response, been quite a hectic couple of months! I've been running some tests on the script and have had no issues.

    Could you possibly tell me what other plug-ins you are using that may be conflicting, and whether you are still having the same issues?

    I'll continue to try and replicate the issue you have stated in order to get the script working properly.

    Alex

    reply

Add A Comment To This Blog