// ==UserScript==
// @name           Locate Domain in Search Results
// @filename       locate_domain_in_search_.user.js
// @author         Mark Stoecker
// @homepage       http://www.poundbangwhack.com
// @namespace      http://www.poundbangwhack.com/greasemonkey/highlight-domain-in-search-results/
// @version        1.0
// @description    Locate a specific domain easily within the results of a Google, Yahoo!, or Bing Search
// @include        http://www.google.com/search*
// @include        http://google.com/search*
// @include        http://search.yahoo.com/*
// @include        http://bing.com/search*
// @include        http://www.bing.com/search*
// ==/UserScript==

//***********************BEGIN CONFIGURATION**********************//
// Set the site variable to the site you wish to locate (without www is best)
// Set the color variable to the background color you wish to use to highlight your domain (defaults to light red)
var site=''
var color='#fcc';
//************************END CONFIGURATION***********************//


//*******************DO NOT EDIT PAST THIS LINE*******************//
//****************UNLESS YOU KNOW WHAT YOU'RE DOING***************//
var all_links=document.getElementsByTagName('a');
if (location.hostname.indexOf("google.com")!=-1) {
	for (i=0; i<all_links.length; i++) {
		if (all_links[i].className!='l') { continue; }
		var href=all_links[i].getAttribute('href');
		if (href.indexOf(site)==-1) { continue; }
		var result=all_links[i].parentNode.parentNode;
		result.style.backgroundColor=color;
	}
}
else if (location.hostname.indexOf("yahoo.com")!=-1) {
	for (i=0; i<all_links.length; i++) {
		if (all_links[i].className!=('yschttl spt')) { continue; }
		var href=all_links[i].getAttribute('href');
		if (href.indexOf(site)==-1) { continue; }
		var result=all_links[i].parentNode.parentNode.parentNode;
		result.style.backgroundColor=color;
	}
}
else if (location.hostname.indexOf("bing.com")!=-1) {
var all_divs=document.getElementsByTagName('div');
	for (i=0; i<all_divs.length; i++) {
		if (all_divs[i].className!='sb_tlst') { continue; }
		var link=all_divs[i].childNodes[0].childNodes[0];
		var href=link.getAttribute('href');
		if (href.indexOf(site)==-1) { continue; }
		var result=link.parentNode.parentNode.parentNode;
		result.style.backgroundColor=color;
	}
}
