Jump to content

User:Mr.Z-man/gsearch.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// For description, see [[User:Mr.Z-man/gsearch]]

function gsearch() {
  var elem;
  if (mw.config.get('skin') == "vector") {
    elem = document.getElementById('searchform').parentNode;
  } else {
    elem = document.getElementById('searchBody');
  }
  elem.innerHTML +=
  '<div style="font-size:0.3em"><br/></div><div align="left"><h5><label for="searchInput">Google Search</label></h5></div>'+
			'<form action="http://www.google.com/search?sitesearch=en.wikipedia.org">'+
				'<input id="searchInput" name="q" type="text" title="Search Wikipedia [f]" accesskey="f" value="" />'+
				'<input type=\'submit\' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" title="Search the wiki for this text" />'+
                                '<input type="radio" name="sitesearch" value="en.wikipedia.org" id="wikisearch" style="display:none;" checked>'+
			'</form>';
}
$(gsearch);