Aller au contenu

Discussion utilisateur:Escherichia coli/Sigles

Le contenu de la page n’est pas pris en charge dans d’autres langues.
Une page de Wikipédia, l'encyclopédie libre.

Jeu de test pour comparer les performances des sites[modifier le code]

à faire --Esch. coli 7 avril 2008 à 16:03 (CEST)[répondre]

SearchBox[modifier le code]

Pour créer un machin comme special:search destiné aux sigles, il faudrait sans doute ajouter qqch à MediaWiki:Common.js...

Le machin en question :

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 optId = document.getElementById('searchEngine').selectedIndex;
   var optSelected = searchEngines[optId];
   searchForm.action = optSelected[0];
   searchBox.name = optSelected[1];
   searchForm.title.value = optSelected[3];
   searchForm.title.name = optSelected[2];
   // stockage du moteur dans un cookie
   document.cookie = "searchEngineId=" + optId;
 }
 selectBox.appendChild(createOption('Recherche interne', wgScriptPath + '/index.php', 'search', 'title', 'Special:Recherche'));
 selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'fr'));
 selectBox.appendChild(createOption('Google', 'http://www.google.fr/search', 'q', 'sitesearch', 'fr.wikipedia.org'));
 selectBox.appendChild(createOption('Wikiwix', 'http://fr.wikiwix.com/', 'action', 'lang', 'fr'));
 selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://fr.wikipedia.org'));
 selectBox.appendChild(createOption('Yahoo', 'http://fr.search.yahoo.com/search', 'p', 'vs', 'fr.wikipedia.org'));
 selectBox.appendChild(createOption('Global WP Search', 'http://vs.aka-online.de/cgi-bin/globalwpsearch.pl', 'search', 'timeout', '15'));
 // récupération du dernier moteur utilisé stocké dans un cookie
 var defaultId = getCookieVal("searchEngineId");
 if (defaultId) {
   selectBox.selectedIndex = defaultId;
 }
 searchBox.style.marginLeft = '0px';
 if (document.getElementById('loadStatus')) {
   var lStat = document.getElementById('loadStatus');
 } else {
   var lStat = searchForm.fulltext;
 }
 lStat.parentNode.insertBefore(selectBox, lStat);
}

Je sais pas faire.