// ]
//<syntaxhighlight lang="JavaScript">
/** Change Special:Search to use a drop-down menu *******************************************************
*
* Description: Change Special:Search to use a drop-down menu, with the default being
* the internal MediaWiki engine
* Created and maintained by: ]
*/
function SpecialSearchEnhanced() {
var createOption = function(site, action, mainQ, addQ, addV) {
var opt = document.createElement('option');
opt.appendChild(document.createTextNode(site));
searchEngines.push();
return opt;
}
if (document.forms)
var searchForm = document.forms;
if (document.forms)
var searchForm = document.forms;
if (searchForm.lsearchbox) {
var searchBox = searchForm.lsearchbox;
} else {
var searchBox = searchForm.search;
}
var selectBox = document.createElement('select');
selectBox.id = 'searchEngine';
searchForm.onsubmit = function() {
var optSelected = searchEngines;
searchForm.action = optSelected;
searchBox.name = optSelected;
searchForm.title.value = optSelected;
searchForm.title.name = optSelected;
}
var domain = mw.config.get('wgServer').replace(/^.*?\/\//, '');
selectBox.appendChild(createOption('Recherche interne', mw.config.get('wgScriptPath') + '/index.php', 'search', 'title', 'Special:Search'));
selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', domain));
selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', domain));
selectBox.appendChild(createOption('Bing', 'http://www.bing.com/search', 'q', 'q1', 'site:' + domain));
selectBox.appendChild(createOption('Wikiwix', 'http://www.wikiwix.com/', 'action', 'lang', 'fr'));
selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'fr'));
searchBox.style.marginLeft = '0px';
if (document.getElementById('loadStatus')) {
var lStat = document.getElementById('loadStatus');
} else {
var lStat = searchForm.title;
if( typeof lStat == 'object' && typeof lStat.length === 'number' ) lStat = lStat;
}
lStat.parentNode.insertBefore(selectBox, lStat);
}
var searchEngines = ;
if (mw.config.get('wgCanonicalSpecialPageName') == "Search"){ //scripts specific to Special:Search
jQuery(document).ready(SpecialSearchEnhanced);
}
//</syntaxhighlight>