Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

'Google Counter' - numbering results with Javascript

         

Badger37

5:43 pm on Jan 11, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



A year or so back I found a useful tip here (I remember Brett said it was one of his favs and thanking the poster!) where you can run a JS command to numerically number your Google results.

After adding the code below to your favourites you could perform a Google search and then run the command which would number the results. It was very useful to see that a particular site was at number 37 etc. without having to manually count...

I've noticed that this script stopped working a while back.

I've tried searching for the thread and any info without success - can anyone shed any light on this?

Thanks in advance.

This is the code:

javascript:var p=document.getElementsByTagName('p');var j=1;function gc(){for(i=0;i<p.length;i++){if(p[i].className=='g'){p[i].innerHTML=j+'. '+p[i].innerHTML;j++;}};};gc();

Badger37

2:39 pm on Jan 12, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Fixed it!

Google has changed - the 'P' now needs to be 'div'.

So the code that works is:

javascript:var p=document.getElementsByTagName('div');var j=1;function gc(){for(i=0;i<p.length;i++){if(p[i].className=='g'){p[i].innerHTML=j+'. '+p[i].innerHTML;j++;}};};gc();

For those that haven't seen this useful script...
To numerically number the results after performing a search in Google you can perform the search and then either paste the above code in the address bar which will number the results - or add the command as a favourite/bookmark. This then means that you can simply number the results by clicking the favourite.

LunaC

3:16 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



There's a few handy GreaseMonkey scripts for this to. Number Google Results Remixed (I had to edit the p to a div in this one as well, although the original script may have been updated by now).

There's also one to number MSN results that works on Live and MSN search. (I might have edited it to add Live.. I can't remember.)

Very handy, and for me easier than a bookmarklet since once it's enabled, it's always enabled until it's turned off.