Aller au contenu

« MediaWiki:Monobook.js » : différence entre les versions

La bibliothèque libre.
Contenu supprimé Contenu ajouté
Validé.png
Pmartin (discussion | contributions)
Aucun résumé des modifications
Ligne 648 : Ligne 648 :
*/
*/
if ((wgNamespaceNumber == -1) && (wgCanonicalSpecialPageName == "Search")) {
if (wgPageName == "Special:Recherche") {
var searchEngines = [];
var searchEngines = [];

Version du 14 décembre 2008 à 14:42

/*********************
Indicateurs de qualité
Auteur: ThomasV
*********************/

function textQuality() {

	if(wgAction!='view' && wgAction!='submit' && wgAction!='purge') return;
	if(wgCanonicalNamespace != "") return;
	if( document.getElementById("Author") ) { a.firstChild.innerHTML = "Auteur"; return;}

	if(wgPageName.substring(0,8) == "Portail:") return;

	var a = document.getElementById("ca-nstab-main"); if(!a) return;

	var q = document.getElementById("textquality")
	if( q ) {
		var t = q.className;
		var new_img = document.createElement("img");
                if(t == 'Textes validés') new_img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Compar%C3%A9.png/10px-Compar%C3%A9.png");
		else new_img.setAttribute("src", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
		new_img.setAttribute("title", "état d'avancement: "+t.substring(0,t.length-1)+'%');
		a.firstChild.appendChild(new_img);
	}

	var q = document.getElementById("pr_index")
	if( q ) {
		href = q.firstChild; if(!href) return;
		q.removeChild(href);
		href.innerHTML = "<img src='http://upload.wikimedia.org/wikipedia/commons/thumb/9/92/Open_book_nae_02.svg/20px-Open_book_nae_02.svg.png' />";
		href.setAttribute("title", "Voir la liste des pages et participer à la correction de ce livre");
		var new_li = document.createElement("li");
		new_li.appendChild(href); 
		a.parentNode.insertBefore(new_li,a.nextSibling);
	} 
	else {
		if( ! document.getElementById("pr_page")) {
			var c = document.getElementById("contentSub");
			c.innerHTML = c.innerHTML + "<span></span>";
		}
	}
}




addOnloadHook(textQuality);



/*
Interwikiextra
Auteur:ThomasV
*/


function interwikiExtra() 
{
   // iterate over all <span>-elements
   for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
      // if found a linkInfo span
      if(a.className == "interwiki-info") {
         // iterate over all <li>-elements
         var count=0;
         
         for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
            if(b.className == "interwiki-" + a.id) {
               b.innerHTML = b.innerHTML + " "+a.title;
               if(a.title == "(vo)") { b.title = "Texte original"; }
            }
         else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
               count = count+1;
               if(a.id.charAt(a.id.length-1) == count) {
                  b.innerHTML = b.innerHTML + " "+a.title;
               }
            }
         }
      }
      if(a.className == "AutreVersion") {
         p = a.title.indexOf("|");
         pvers = document.getElementById("p-version");
         if (pvers == null) {
           c = document.getElementById("column-one");
           c.innerHTML = c.innerHTML
             + "<div class=\"portlet\" id=\"p-version\">"
             + "<h5>Autres versions</h5>"
             + "<div class=\"pBody\">"
             + "<ul>"
             + "</ul>"
             + "</div>";
             pvers = document.getElementById("p-version");
           }
           e = pvers.getElementsByTagName("ul")[0]; 
           e.innerHTML = e.innerHTML 
             + "<li class=\"\"><a href='" 
             + a.title.substr(0,p)
             + "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>"
      }
   }
}

addOnloadHook(interwikiExtra);




/*
Liens bilingues
Fonctionne avec l'extension DoubleWiki. 
Auteur: ThomasV
*/


function BilingualLink() 
{
    if( wgNamespaceNumber != 0) return;
    var doc_url = document.URL;
    var url = '';
    // iterate over all <li>-elements
    for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
         if(b.className.substring(0,10) == "interwiki-" ) {
               var lang = b.className.substring(10,b.className.length);
               if( doc_url.indexOf('?title=') != -1 ) { 
                   var qm  = doc_url.indexOf('&match=');
                   if( qm != -1 ) url = doc_url.substring(0,qm)+"&match="+lang;
                   else url = doc_url+"&match="+lang;
               } else {
                   var qm  = doc_url.indexOf('?');
                   if( qm != -1 ) url = doc_url.substring(0,qm)+"?match="+lang;
                   else url = doc_url+"?match="+lang;
               }
               b.innerHTML = b.innerHTML+"<a href='"+url+"'> &hArr;</a>";
             }
         }
}

addOnloadHook(BilingualLink);


/*
code utilisé par le modèle interprojet
*/

document.write('<style type="text/css">#interProject {display: none; speak: none;} #p-tb .pBody {padding-right: 0;}<\/style>');
function iProject() {
  if (document.getElementById("interProject")) {
   var iProject = document.getElementById("interProject").innerHTML;
   var interProject = document.createElement("div");
   interProject.style.marginTop = "0.7em";
   interProject.innerHTML = '<h5>compléments<\/h5><div class="pBody">'+iProject+'<\/div>';
   document.getElementById("p-tb").appendChild(interProject);
  }
}
hookEvent("load", iProject);



/*</pre>
===Options d'affichage===
Voir [[:Modèle:Option]]. Auteur:ThomasV
<pre>*/


//Cookies
 function SetCookie(name,value) {
        document.cookie = name + "=" + escape(value);
 }
  
 function GetCookie(name) {
        var i =0;
        while (i < document.cookie.length) {
                if (document.cookie.substr(i,name.length) == name) {
                        var valend = document.cookie.indexOf(";",i+name.length+1);
                        if (valend == -1) {
                                valend = document.cookie.length;
                        }
                        return unescape(document.cookie.substring(i+name.length+1,valend));
                }
                i = document.cookie.indexOf(" ", i) + 1;
                if (i == 0) break;
        }
 }


 function OptionText() {
   var indexNavigationBar = 0;
   // iterate over all < span >-elements until class "OptionText" is found
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
       // if found an option span
       if (SpanElem.className == "OptionText") {
          //SpanElem.style.display = 'none';
          OptionTitle = SpanElem.title;
          OptionStyle = SpanElem.firstChild.getAttribute('style');

          //check if option was already encountered...
          if(!document.getElementById(OptionTitle)){

            //read cookie
            var DisplayOptionDefault = true;
            CookieDisplayOption = GetCookie ("Display"+OptionTitle)
            if (CookieDisplayOption ) {
            if (CookieDisplayOption == "false") DisplayOptionDefault = false; }

            var PageDisplay = document.createElement("li");
            PageDisplay.setAttribute('id', OptionTitle);
            var PageDisplayLink = document.createElement("a");

            OptionText = document.createTextNode("Désactiver "+OptionTitle);
            PageDisplayLink.appendChild(OptionText);
            PageDisplayLink.setAttribute('href','javascript:displayOptionText("'+OptionTitle+'","' + OptionStyle +'", '+DisplayOptionDefault+');');
            PageDisplay.appendChild(PageDisplayLink);

            var optlist = document.getElementById("optlist");
            if(!optlist) {
               var displayOptions = document.createElement("div");
               displayOptions.style.marginTop = "0.7em";
               displayOptions.innerHTML = '<h5>options d’affichage<\/h5><div class="pBody"><ul id="optlist"></ul><\/div>';
               document.getElementById("p-tb").appendChild(displayOptions);
               optlist = document.getElementById("optlist");
            }
            optlist.appendChild(PageDisplay);

            displayOptionText(OptionTitle,OptionStyle,DisplayOptionDefault);
          }
       }
   }
 }

 function displayOptionText(optiontitle, optionstyle, bool) {
  
  SetCookie ("Display"+optiontitle,bool);
  var PageDisplayLink =  document.getElementById(optiontitle).firstChild;;

   // iterate over all < span >-elements
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
        // if found an option text
        if ((SpanElem.className == "OptionText") && (SpanElem.title == optiontitle)) {
          if(bool==true ) {
            SpanElem.setAttribute('style',optionstyle);
            PageDisplayLink.firstChild.data = (optiontitle);
            PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", false);');
          }
          if(bool==false) {
            SpanElem.setAttribute('style','null');
            PageDisplayLink.firstChild.data = (optiontitle);
            PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", true);');

         }        
      }
   }
 }

addOnloadHook(OptionText);


/****
*Mode édition
*****/

if(wgAction=='edit' || wgAction=='submit') {


	/*
	 *Boutons Qualité
	 *Auteur: ThomasV
	 */


	function addQuality(form,value){

		var text="";
		switch(value){
			case "25%": text = "Texte incomplet"; break;
			case "50%": text = "Texte non formaté"; break;
			case "75%": text = "Complet et formaté"; break;
			case "100%": text = "Relu et corrigé"; break;
                        case "Textes validés": text = "Validé"; break;
			case "mode_page|": text = "Texte en mode page"; break;
		} 

		form.elements["wpSummary"].value="/* "+text+" */";
		s = form.elements["wpTextbox1"].value;
		s = s.replace(/\{\{TextQuality\|(.*?)\}\}/gi,"")
		form.elements["wpTextbox1"].value="{"+"{TextQuality|"+value+"}"+"}"+s;
	}


	function addQualityButtons(){
		if( wgNamespaceNumber != 0 ) return;
		var ig  = document.getElementById("wpWatchthis"); 
		if(!ig) return;

		var f = document.createElement("span");
        	f.innerHTML = ' <input type="radio" name="quality" value="25%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/25%25.png">'+'<input type="radio" name="quality" value="50%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/50%25.png">'+'<input type="radio" name="quality" value="75%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/75%25.png">'+'<input type="radio" name="quality" value="100%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/100%25.png">'+'<input type="radio" name="quality" value="Textes validés" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/Validé.png">'
//+'<input type="radio" name="quality" value="mode_page|" onclick="addQuality(this.form,this.value)"><img src = "http://upload.wikimedia.org/wikipedia/commons/thumb/9/92/Open_book_nae_02.svg/20px-Open_book_nae_02.svg.png">'
+' Niveau d\’avancement du texte';
		ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling)
	}

	addOnloadHook(addQualityButtons);




	/***
	*Expressions régulières
	*Auteur: ThomasV, Pathoschild
	*Note : cet outil utilise la syntaxe javascript : on utilise $ (et pas \) pour appeler un groupe dans la chaîne de remplacement.
	*Tutoriel : http://www.regular-expressions.info/tutorial.html
	****/

	/* create form */
	function custom() {

		/* if already open */
		if(document.getElementById('regexform')) customremove()
		else {	
                        var editbox = document.getElementById('wpTextbox1');
			/* container */
			var regexform = document.createElement('div');
			regexform.setAttribute('id','regexform');
			editbox.parentNode.insertBefore(regexform,editbox.parentNode.firstChild);

			/* form tag */
			var formform = document.createElement('form');
			formform.setAttribute('id','regexformform');
			formform.setAttribute('onSubmit','customgo(); return false;');
			regexform.appendChild(formform);
	
			// add input boxes
		        var newinput = document.createElement('input');
		        newinput.setAttribute('id','formsearch');
		        var newlabel = document.createElement('label');
		        newlabel.setAttribute('for','formsearch');
			newlabel.appendChild(document.createTextNode("Remplacer "));

			formform.appendChild(newlabel);
			formform.appendChild(newinput);
		
			var newinput = document.createElement('input');
			newinput.setAttribute('id','formreplace');
			var newlabel = document.createElement('label');
			newlabel.setAttribute('for','formreplace');
			newlabel.appendChild(document.createTextNode(' par '));
		
			formform.appendChild(newlabel);
			formform.appendChild(newinput);

			// go! link
			var go_button = document.createElement('input');
			go_button.setAttribute('type',"submit");
			go_button.setAttribute('title',"go!");
			go_button.setAttribute('value',"go!");
			formform.appendChild(go_button);

		}
	}
	


	/* run patterns */
	function customgo() {
		/* get search and replace strings */

                search = document.getElementById('formsearch').value;
		search = search.replace(/\\n/g, '\n');

                replace = document.getElementById('formreplace').value;
		replace = replace.replace(/\\n/g, '\n');

		/* convert input to regex */

		// without delimiters
		if(!search.match(/^\s*\/[\s\S]*\/[a-z]*\s*$/i)) {
			search = new RegExp(search,'g');
		}
		// with delimiters
		else {
			// break into parts
			var regpattern = search.replace(/^\s*\/([\s\S]*)\/[a-z]*\s*$/i,'$1');
			var regmodifiers = search.replace(/^\s*\/[\s\S]*\/([a-z]*)\s*$/,'$1');
			// filter invalid flags
			regmodifiers = regmodifiers.replace(/[^gim]/ig,'');

			search = new RegExp(regpattern, regmodifiers);
		}

		/* perform */
                var editbox = document.getElementById('wpTextbox1');
		editbox.value = editbox.value.replace(search,replace);

	}

	/* remove form */
	function customremove() {
		var regexform = document.getElementById('regexform');
		regexform.parentNode.removeChild(regexform);
		patterncount = -1;
	}


	/*******************
	*** create button
	********************/
        function add_regexp_button(){

		var toolbar = document.getElementById("toolbar");
		if(toolbar){
			var image = document.createElement("img");
			image.width = 23;
			image.height = 22;
			image.border = 0;
			image.className = "mw-toolbar-editbutton";
			image.style.cursor = "pointer";
			image.alt = "regexp";
			image.title = "Expression régulière";
			image.src = "http://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png";
			image.onclick = custom;
			toolbar.appendChild(image);
                }
       }
       
       addOnloadHook(add_regexp_button)

	/*
	===Edittools===
	*/

	/* add menu for selecting subsets of special characters */
	/***** must match MediaWiki:Edittools *****/
	function addCharSubsetMenu() {
		var specialchars = document.getElementById('specialchars');

		if (specialchars) {
			var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
			menu += "<option>Document</option>";
			menu += "<option>Poésie</option>";
			menu += "<option>Théâtre</option>";
			menu += "<option>Auteur</option>";
			menu += "<option>Latin étendu</option>";
			menu += "<option>Grec</option>";
			menu += "<option>Hébreu</option>";
			menu += "<option>Cyrillique</option>";
			menu += "<option>InterWiki</option>";
			menu += "<option>Maintenance</option>";
			menu += "</select>";
			specialchars.innerHTML = menu + specialchars.innerHTML;

			/* default subset - try to use a cookie some day */
			chooseCharSubset(0);
		}
	}

/* select subsection of special characters */
function chooseCharSubset(s) {
  var l = document.getElementById('specialchars').getElementsByTagName('p');
  for (var i = 0; i < l.length ; i++) {
    l[i].style.display = i == s ? 'inline' : 'none';
    l[i].style.visibility = i == s ? 'visible' : 'hidden';
  }
}

addOnloadHook(addCharSubsetMenu);

/****************************************/
function mwInsertEditButton(parent, item) {
        var image = document.createElement("img");
        image.width = 23;
        image.height = 22;
        image.src = item.imageFile;
        image.border = 0;
        image.style.cursor = "pointer";
        var ref = document.createElement("a")
        ref.setAttribute("href", "javascript:insertTags(\"" + item.tagOpen + "\",\"" + item.tagClose + "\",\"" + item.sampleText + "\");")
        ref.setAttribute("title", item.speedTip);
        ref.appendChild(image);
        
        parent.appendChild(ref);
}

/*</pre>

===Générateur de tableaux===
<pre>*/

/**
 *
 * English: Generate an array using Mediawiki syntax
 *
 * @author: fr:user:dake
 * @version: 0.1
 */
 
function generateTableau(nbCol, nbRow, border, styleHeader, styleLine)
{
        var code = "\n";
        if (styleHeader==1) {
                code += '{{entête tableau charte}}\n';
        } else {
                code += '{| border="' + border + '"\n';
                code += '|+ Titre du tableau\n';
        }
        
        for (var i=0;i<nbCol;i++) code += '! en-tête ' + i + '\n'
        
        for (var j=0;j<nbRow;j++) {
                if ((j+1)%2==0 && styleLine==1) {
                        code += '|-{'+'{ligne grise}'+'}\n'
                } else {                
                        code += '|-----\n'
                }
                
                for (var i=0;i<nbCol;i++) code += '| élément\n';
        }
        
        code += '|}';
        insertTags('','', code); 
}

/**
 *
 * English: Open a popup with parameters to generate an array. 
 * The number of rows/columns can be modified. Some additional
 * parameters are related to templates available on :fr
 *
 * @author: fr:user:dake
 * @version: 0.1
 */
 
function popupTableau()
{
  var popup = window.open('','name','height=400,width=500');
  
  javaCode =  '<script type="text\/javascript">function insertCode(){';
  javaCode += 'var row = parseInt(document.paramForm.inputRow.value); '
  javaCode += 'var col = parseInt(document.paramForm.inputCol.value); '
  javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); '
  javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; '
  javaCode += 'var styleLine = document.paramForm.inputLine.checked; '
  javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine); '
  javaCode += '}<\/script>';
  
  popup.document.write('<html><head><title>Paramètres du tableau</title>');
  popup.document.write('<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><!-- wikibits js --><\/script>');
  popup.document.write('<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>');
  popup.document.write(javaCode); 
  popup.document.write('</head><body>');
  popup.document.write('<p>Veuillez entrer les paramètres du tableau : </p>');
  popup.document.write('<form name="paramForm">');
  popup.document.write('Nombre de lignes : <input type="text" name="inputRow" value="3" ><p>');
  popup.document.write('Nombre de colonnes : <input type="text" name="inputCol" value="3" ><p>');
  popup.document.write('Largeur de la bordure : <input type="text" name="inputBorder" value="1" ><p>');
  popup.document.write('En-tête en gris (style « charte graphique ») : <input type="checkbox" name="inputHeader" checked="1" ><p>');
  popup.document.write('Lignes grises alternées (style « charte graphique ») : <input type="checkbox" name="inputLine" checked="1" ><p>');
  popup.document.write('</form">');
  popup.document.write('<p><a href="javascript:insertCode()"> Insérer le code dans la fenêtre d\'édition</a></p>');
  popup.document.write('<p><a href="javascript:self.close()"> Fermer</a></p>');
  popup.document.write('</body></html>');
  popup.document.close();
}


/*</pre>
===Insertion de nouveaux boutons dans la barre d'outil===
<pre>*/


//============================================================
// Insertion de nouveaux boutons dans la barre d'outils
//============================================================

//Remplit la variable mwCustomEditButtons (voir /skins-1.5/commons/wikibits.js) pour ajouter des boutons à la barre d'outils
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText)
{
 mwCustomEditButtons[mwCustomEditButtons.length] =
 {"imageFile": imageFile,
  "speedTip": speedTip,
  "tagOpen": tagOpen,
  "tagClose": tagClose,
  "sampleText": sampleText};
}

addCustomButton('http://upload.wikimedia.org/wikipedia/commons/8/8f/Button_poeme.png','Poésie','<poem>\\n\\n','\\n</poem>','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png','Commentaire','<!--','-->','Insérer votre commentaire');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png','Redirection','#REDIRECT \[\[','\]\]','nom de la destination');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png','Catégorie','\[\[Catégorie:','\]\]','nom de la catégorie');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/5/5f/Button_center.png','Texte centré','\{\{subst\:Centrer\}\}','</div>','Texte centré');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/e/e9/Button_headline2.png','paragraphe niveau 3','===','===','');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png', 'Insérer un retrait',':','',':' );
addCustomButton('http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png','Texte plus petit','<small>','</small>','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/5/56/Button_big.png','Texte plus grand','<big>','</big>','');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png','Exposant','<sup>','</sup>','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/4/4b/Button_nbsp.png','Espace insécable','&nbsp\;','','');
addCustomButton('http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png','Aller à la ligne','<br />','','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/4/4b/Button_class_text.png', 'Paragraphe texte','<div class=\'text\'>\\n\\n','\\n</div>','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/7/78/Button_titre.png','Titre de page','\{\{Titre\|','\|\|\}\}','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/0/03/Button_chapitre.png','Titre de Chapitre','\{\{chapitre\|1=','\|2=\|3=\|type=\|nrchapitre=\|TitreChapitre=\|commentaires=\}\}','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/0/07/Button_justice.png','Titre de texte légal','\{\{Légal\\n\|1=','\\n\|2=\\n|3=\\n\}\}','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png','Ajouter une note ou référence','<ref>','</ref>','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/9/9a/Button_references.png','Liste des références','<references />','','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c3/Button_travaux.png','Infoédit','\{\{Infoédit\\n\|1=','\\n\|2=\\n\|3=\\n\|4=\\n\|5=\\n\|6=\\n\}\}','');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/4/4c/Button_interprojet.png','Interprojet','\{\{Interprojet\\n\|nolink\\n\|etiq=','\\n\|w=\\n\|n=\\n\|wikt=\\n\|b=\\n\|q=\\n\|v=\\n\|wikispecies=\\n\|commons=\\n\|m=\\n\}\}','');
//Ressemble à la fonction de /skins-1.5/commons/wikibits.js pour insérer un autre lien que insertTags
function marque_tab()
{
 var toolbar = document.getElementById('toolbar');
 if (!toolbar) return false;
 
 var textbox = document.getElementById('wpTextbox1');
 if (!textbox) return false;
 
 if (!document.selection && textbox.selectionStart == null)
 return false;
 
 var image = document.createElement("img");
 image.width = 23;
 image.height = 22;
 image.src = 'http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png';
 image.border = 0;
 image.alt = 'Tableau';
 image.title = 'Tableau';
 image.style.cursor = "pointer";
 image.onclick = function() {
   popupTableau();
   return false;
 }
 toolbar.appendChild(image);
}

addOnloadHook(marque_tab);


} /* endif edition*/

/** 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: [[User:Gracenotes]]
   */
 
 if ((wgNamespaceNumber == -1) && (wgCanonicalSpecialPageName == "Search")) {
         var searchEngines = [];
 
         addOnloadHook(SpecialSearchEnhancedX);
 }
 
 function SpecialSearchEnhancedX() {
         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;
         }
         var searchForm = document.forms['search'];
         if (! searchForm) searchForm = document.forms['powersearch'];
 
         var selectBox = document.createElement('select');
         selectBox.id = 'searchEngine';
 
         searchForm.onsubmit = function() {
                 var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
                 searchForm.action = optSelected[0];
 
                 searchInput = document.getElementById("searchText");
                 if (! searchInput) searchInput = document.getElementById("powerSearchText");
                 searchInput.name = optSelected[1];
 
                 searchForm.title.value = optSelected[3];
                 searchForm.title.name = optSelected[2];
         }
 
         selectBox.appendChild(createOption('Moteur interne', wgScriptPath + '/index.php', 'search', 'title', 'Special:Recherche'));
         selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'fr.wikisource.org')); 
         selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://fr.wikisource.org'));
         selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'fr.wikisource.org'));
         selectBox.appendChild(createOption('WiKiwix', 'http://fr.wikiwix.com/index.php', 'action', 'disp', 'source'));
 
         searchInput = document.getElementById("searchText");
         if (! searchInput) searchInput = document.getElementById("powerSearchText");
 
         searchInput.parentNode.insertBefore(selectBox, searchInput.nextSibling);
 }/*
Déplace les liens portails vers la boite de catégorie
-------------------------

Copyright 2007, fr:user:Aoineko. Licence GFDL et GPL.
*/
var gUseMovePortalToCategoryBox = 1;

function movePortalToCategoryBox()
{
   if(!gUseMovePortalToCategoryBox)
      return;

   // search for portails
   var div_portal = document.getElementById('portallinks');
   if(div_portal && (div_portal.className == 'movable'))
   {
      div_portal.style.display = 'none'; // hide the portail div

      var div_cat = document.getElementById('catlinks'); // get cat div
      if(!div_cat) // no category box ? then create it
      {
         var div_foot;
         var divs = document.getElementsByTagName('div');
         for(var i = 0; i < divs.length ; i++)
            if(divs[i].className == 'printfooter')
               div_foot = divs[i];

         div_cat = document.createElement("div");
         div_cat.setAttribute('id', 'catlinks');

         div_foot.parentNode.insertBefore(div_cat, div_foot); 
      }

      div_cat.innerHTML = div_portal.innerHTML + '<hr/>' + div_cat.innerHTML;
   }
}

addOnloadHook(movePortalToCategoryBox);