19,800
edits
(New page: →<pre>: //<source lang="JavaScript"> /** Change Special:Search to use a drop-down menu ******************************************************* * * Description: Change Special:Sea...) |
(updating with current version from http://en.wikipedia.org/wiki/MediaWiki:Gadget-externalsearch.js) |
||
| Line 1: | Line 1: | ||
/** Change Special:Search to use a drop-down menu ******************************************************* | /** Change Special:Search to use a drop-down menu ******************************************************* | ||
* | * | ||
| Line 13: | Line 10: | ||
var opt = document.createElement('option'); | var opt = document.createElement('option'); | ||
opt.appendChild(document.createTextNode(site)); | opt.appendChild(document.createTextNode(site)); | ||
searchEngines.push([action, mainQ, addQ, addV]); | |||
return opt; | return opt; | ||
} | } | ||
| Line 36: | Line 33: | ||
searchForm.title.name = optSelected[2]; | searchForm.title.name = optSelected[2]; | ||
} | } | ||
selectBox.appendChild(createOption('MediaWiki | selectBox.appendChild(createOption('MediaWiki Search', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search')); | ||
selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', ' | selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'wiki.oni2.net')); | ||
selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', ' | selectBox.appendChild(createOption('Yahoo!', 'http://search.yahoo.com/search', 'p', 'vs', 'wiki.oni2.net')); | ||
selectBox.appendChild(createOption(' | selectBox.appendChild(createOption('Bing', 'http://www.bing.com/search', 'q', 'q1', 'site:http://wiki.oni2.net')); | ||
searchBox.style.marginLeft = '0px'; | searchBox.style.marginLeft = '0px'; | ||
if (document.getElementById('loadStatus')) { | if (document.getElementById('loadStatus')) { | ||
var lStat = document.getElementById('loadStatus'); | var lStat = document.getElementById('loadStatus'); | ||
} else { | } else { | ||
var lStat = searchForm. | var lStat = searchForm.title; | ||
if( typeof lStat == 'object' && typeof lStat.length === 'number' ) lStat = lStat[0]; | |||
} | } | ||
lStat.parentNode.insertBefore(selectBox, lStat); | lStat.parentNode.insertBefore(selectBox, lStat); | ||
| Line 52: | Line 48: | ||
var searchEngines = []; | var searchEngines = []; | ||
addOnloadHook(SpecialSearchEnhanced); | addOnloadHook(SpecialSearchEnhanced); | ||
} | |||