Wikipedia:WikiProject User scripts/Scripts/Google search

From Wikipedia, the free encyclopedia

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

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

addOnloadHook(function() {
  document.getElementById('searchform').action = ''; 
  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'); = 'as_sitesearch'; = 'as_sitesearch';
  enwp.value = '';
  enwp.type = 'hidden';
  return false;