Greasemonkey Script Stopped Working - Any ideas why?

There's a very handy script that filters the google results to only show results with stars from the stumbleupon community. This script was great for finding the best results fastest. Unfortunalty it stopped working I'm pretty sure when google change how it referenced some of their own page elements. This script has been abandoned by it's author and I have no idea how to fix it. If any can have a look I'd really appreciate it.

Thanks.
http://userscripts.org/scripts/show/26533
// StumbleStars For Google
// version 0.1 alpha
// 2008-05-13
// Copyright (c) 2008, Jason Whitener
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
 
// ==UserScript==
// @name          StumbleStars For Google
// @namespace     http://jasonwhitener.com
// @description   Script to remove anything not marked by a Stumble Star
// @include       http://www.google.com/*
// @include       http://*.google.com/*
// ==/UserScript==
 
tablehits = document.evaluate(
    "//table[@class='t bt']",
    document,
    null,
    XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
    null);
		for (var i = 0; i < tablehits.snapshotLength; i++) {
    thistablehit = tablehits.snapshotItem(i);
    	
			thistablehit.innerHTML = '<input id="btnFilter" type="submit" class="inputbutton" value="See Stumble Stars" onclick="filterit()" />';
			}
			
function filterit() {
allDivgs = document.evaluate(
    "//div[@class='g']",
    document,
    null,
    XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i = 0; i < allDivgs.snapshotLength; i++) {
    thisDivg = allDivgs.snapshotItem(i);
    	
				var myRegExp = /star.png/;
				var string1 = thisDivg.innerHTML;
				var matchPos1 = string1.search(myRegExp);
				
				if(matchPos1 != -1)
					 temp = 'temp';
				else
					thisDivg.innerHTML = '';
 
}
 
}
document.getElementById('btnFilter').addEventListener("click", filterit, true);

Open in new window

FuelUrMindAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BigRatCommented:
It looks as if the css class has changed. Can you give me a Google search term which produces the results you want, and I'll try and establish what has changed.
0
FuelUrMindAuthor Commented:
The script doesn't work with any query's anymore, but used to work with all searches.However, the button to filter the results still shows up on google images though.
example-search.png
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
can you provide a sample page that we can see those stars in search result? I dont see those "stars" in google search so its hard to create / update  script for that :)
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

FuelUrMindAuthor Commented:
As in the html of the page?
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
well... anything.. I trying to help but I never see that star on google search... maybe a URL ? or search case example ?
0
FuelUrMindAuthor Commented:
I've attached a screenshot. If you'd like to generate them yourself you need to install the stumbleupon toolbar. I can send you the html but I don't know if that help without the server side code.

Thanks
7-17-2009-1-04-29-AM.png
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
ok I get it - now I can see what I can do for you :)
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
line 31:

change from:

"//div[@class='g']",


to



"//li[@class='g w0']",





Works for me, at least for now ;)
0
FuelUrMindAuthor Commented:
hm I tried editing and still nothing. Here's the updated script just in case I did something wrong:


// StumbleStars For Google
// version 0.1 alpha
// 2008-05-13
// Copyright (c) 2008, Jason Whitener
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
 
// ==UserScript==
// @name          StumbleStars For Google
// @namespace     http://jasonwhitener.com
// @description   Script to remove anything not marked by a Stumble Star
// @include       http://www.google.com/*
// @include       http://*.google.com/*
// ==/UserScript==
 
tablehits = document.evaluate(
    "//table[@class='t bt']",
    document,
    null,
    XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
    null);
                for (var i = 0; i < tablehits.snapshotLength; i++) {
    thistablehit = tablehits.snapshotItem(i);
        
                        thistablehit.innerHTML = '<input id="btnFilter" type="submit" class="inputbutton" value="See Stumble Stars" onclick="filterit()" />';
                        }
                        
function filterit() {
allDivgs = document.evaluate(
    "//li[@class='g w0']",
    document,
    null,
    XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i = 0; i < allDivgs.snapshotLength; i++) {
    thisDivg = allDivgs.snapshotItem(i);
        
                                var myRegExp = /star.png/;
                                var string1 = thisDivg.innerHTML;
                                var matchPos1 = string1.search(myRegExp);
                                
                                if(matchPos1 != -1)
                                         temp = 'temp';
                                else
                                        thisDivg.innerHTML = '';
 
}
 
}
document.getElementById('btnFilter').addEventListener("click", filterit, true);

Open in new window

0
Pawel WitkowskiSenior Javascript DeveloperCommented:
its probably because google use diffrent classes on your version... then try maybe this:


    "//li",

in the same line instead of

    "//li[@class='g w0']",
0
FuelUrMindAuthor Commented:
I really wish I could say it's working but it's still not. I uploaded a sample html page (to display it just change the extension to html) so you can see what the css classes are for me. Thank you so much for your help on this.
search.txt
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
Sorry for long response I had a free time with my wife :)

I rewrited almost all code, and test it using new greasemonkey so it works for now (i hope for you also). It does work only on search results, because I did not see any responses on images tab. If you find them give me a search response. Cheers
// StumbleStars For Google
// version 0.1 alpha
// 2008-05-13
// Copyright (c) 2008, Jason Whitener
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
 
// ==UserScript==
// @name          StumbleStars For Google
// @namespace     http://jasonwhitener.com
// @description   Script to remove anything not marked by a Stumble Star
// @include       http://www.google.com/*
// @include       http://*.google.com/*
// ==/UserScript==
 
 
	filter_it = function() {
	allDivgs = document.evaluate(
		"//li",
		document,
		null,
		XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
		null);
	for (var i = 0; i < allDivgs.snapshotLength; i++) {
		thisDivg = allDivgs.snapshotItem(i);
			
		var myRegExp = /star.png/;
		var string1 = thisDivg.innerHTML;
		var matchPos1 = string1.search(myRegExp);
		
		if(matchPos1 != -1)
				 temp = 'temp';
		else
				thisDivg.innerHTML = '';
	 
	}
	return false;
}
 
var script = document.createElement('script'); 
script.innerHTML= "filter_it="+ filter_it.toSource();
script.type="text/javascript";
document.body.appendChild(script);
 
var forms=document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) {
	var el = forms[i].appendChild(document.createElement('div'));
	el.innerHTML = '<button onclick="filter_it();return false">See Stumble Stars</button>';
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FuelUrMindAuthor Commented:
Holy crap I freaking love you man! Works perfectly and no it's not supposed to do anything on Google images. You are a god.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.