From Wikipedia, the free encyclopedia

// <syntaxhighlight lang="javascript">

// Adds toolbox links to search Google web, news archive, books, scholar, and images for the title of the page.



addOnloadHook(function () {

    if (mw.config.get('wgCanonicalNamespace') == "Special")

        return;  // no links for special pages



    var title = mw.config.get('wgTitle');

    if (mw.config.get('wgCanonicalNamespace') != "")

        title = title.replace(/^.*\//, "");  // subpage name only



    var query = encodeURIComponent('"'+title+'" -Wikipedia' ); 

    addPortletLink('p-tb', 'http://www.google.com/search?&q='+query,

                   'Web search', 't-googlesearch', 'Search Google for "'+title+'"', 'W');

    addPortletLink('p-tb', 'http://www.google.com/search?&tbm=nws&tbs=ar:1&q='+query,

                   'News search', 't-googlenewssearch', 'Search Google News Archive for "'+title+'"', 'N');

    addPortletLink('p-tb', 'http://books.google.com/books?&as_brr=0&as_pub=-icon&q='+query,

                   'Books search', 't-googlebookssearch', 'Search Google Books for "'+title+'"', 'B');

    addPortletLink('p-tb', 'http://scholar.google.com/scholar?&q='+query,

                   'Scholar search', 't-googlescholarsearch', 'Search Google Scholar for "'+title+'"', 'S');

    addPortletLink('p-tb', 'http://www.google.com/images?safe=off&tbm=isch&q='+query,

                   'Images search', 't-googleimagesearch', 'Search Google Images for "'+title+'"', 'I');

});



//</syntaxhighlight>