Wikipedia:WikiProject User scripts/Scripts/Google search

This script makes the wikipedia search bar use google. Hitting enter or clicking G does a google search for the term with the en.wikipedia.org domain. Clicking lucky goes directly to the first result of the search. Script courtesy of Splarka.

:--St.isaac 21:29, 17 July 2007 (UTC)

addOnloadHook(function() {

document.getElementById('searchform').action = 'http://www.google.com/search';

document.getElementById('searchInput').name = 'q';

document.getElementById('searchGoButton').name = 'btnG';

document.getElementById('mw-searchButton').name = 'btnI';

document.getElementById('searchGoButton').value = 'G';

document.getElementById('mw-searchButton').value = 'Lucky!';

var enwp = document.createElement('input');

enwp.id = 'as_sitesearch';

enwp.name = 'as_sitesearch';

enwp.value = 'en.wikipedia.org';

enwp.type = 'hidden';

document.getElementById('searchform').appendChild(enwp);

return false;

});