AutoPagerize

By swdyh Last update Dec 28, 2011 — Installed 834,123 times.

Google image search

in
Subscribe to Google image search 3 posts, 3 voices



BlueGazer User

I think Why this script doesn't suport image search?
Please,Anybody fix!

 
Aquilax Scriptwright

Because google images is evil :)
Technical problem: Google images don't send a finished html page with the images but an empty page with an huge javascript function, which adds the images to the page. Only if you have javascript deactivated google images will send a finished html page with the images inside.
All that is regulated from a url parameter, which name is "gbv", if gbv is equal 1, google images send the finished html page, if gbv is equal 2 google images send the empty page with the huge javascript function.
But if you try to change the gbv parameter in the url to 1 so that to receive the finished html page, google images will redirect you to the second version with the huge javascript version. This because google images add also to the finished html page a script function to test if javascript is activated, in that case it will redirect the page to the other version. This means to stay on the finished html version you have to deactivate javascript.
AutoPagerize load the next page with an XMLHttpRequest, this means that javascript will be no executed. The only way to let AutoPagerize works is to receive the finished html version. In case that javascript is deactivated, google images will send the finished html version, and because javascript is deactivated, there will be no redirection to the other version. AutoPagerize is already configured for such case.
But who want to deactivate javascript to auto pagerize googles images? I don't want to do it, so I changed AutoPagerize to works also with google images.
First I've added the to the SITEINFO the information to auto pagerize google images, then I've added a function to convert the googles images link from the huge javascript function (gbv=2) to the finished html version (gbv=1). As said before, the next pages are loaded with XMLHttpRequest, which doesn't execute javascript code, so it can't redirect the loaded pages to the huge javascript function verison.
Here the added code to AutoPagerize:


.....

var SITEINFO = [
    /* sample
    {
        url:          'http://(.*).google.+/(search).+',
        nextLink:     'id("navbar")//td[last()]/a',
        pageElement:  '//div[@id="res"]/div',
        exampleUrl:   'http://www.google.com/search?q=nsIObserver',
    },
    */
    /* template
    {
        url:          '',
        nextLink:     '',
        pageElement:  '',
        exampleUrl:   '',
    },
    */
    
{ //Google Images url: 'http://images\\.google\\.(\\w|\\.)+/images\\?', nextLink: 'id("navbar")//td[last()]/a', pageElement: 'id("navbar")/preceding-sibling::*', exampleUrl: '' } ] //Added function to fix google images links if (location.href.search(/http:\/\/images\.google\.(\w|\.)+\/images\?/)==0) { Array.forEach(document.getElementById("navbar").getElementsByTagName("a"),function(link) { if (link.href.search(/gbv=2/)==-1) link.href+="&gbv=1"; else link.href=link.href.replace(/gbv=2/,"gbv=1"); } ); }
var MICROFORMAT = { ....

 
dudebudbro Scriptwright
FirefoxWindows

The code provided by Aquilax didn't work. Did Google update something in the page? Is there a code that works?

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel