MediaWiki:Gadget-ext-search.js
Dıqqat: Ózgerislerińiz kóriniwi ushın jańa sazlawlarıńızdı saqlaǵannan keyin brauzerdiń keshin tazalaw kerek:
Google Chrome: Ctrl+Shift+R, Mozilla Firefox: Ctrl+Shift+R, Intenet Explorer: Ctrl+F5, Safari: Cmd+Shift+R, Konqueror: F5, Opera: Tools → Preferences arqalı keshti tazalań.
/* Change Special:Search to use a drop-down menu */
if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
var searchEngines = [];
$(SpecialSearchEnhanced);
}
function SpecialSearchEnhanced() {
var createOption = function(site, action, mainQ, addQ, addV) {
var opt = document.createElement('option');
opt.appendChild(document.createTextNode(site));
searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
return opt;
}
if (document.forms['powersearch'])
var searchForm = document.forms['powersearch'];
// if (document.forms['search'])
// var searchForm = document.forms['search'];
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[document.getElementById('searchEngine').selectedIndex];
searchForm.action = optSelected[0];
searchBox.name = optSelected[1];
searchForm.title.value = optSelected[3];
searchForm.title.name = optSelected[2];
}
selectBox.appendChild(createOption('MediaWiki search', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search'));
selectBox.appendChild(createOption('Google', 'http://www.google.co.uz/search', 'q', 'sitesearch', 'kaa.wikipedia.org'));
selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'kaa.wikipedia.org'));
selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://kaa.wikipedia.org'));
//selectBox.appendChild(createOption('Wikiwix', 'http://www.wikiwix.com/', 'action', 'lang', 'kaa'));
//selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'kaa'));
searchBox.style.marginLeft = '0px';
if (document.getElementById('loadStatus')) {
var lStat = document.getElementById('loadStatus');
} else {
var lStat = searchForm.fulltext;
}
lStat.parentNode.insertBefore(selectBox, lStat);
}