Aller au contenu

Utilisateur:Grondin/common.js

Une page de Wikiquote, le recueil des citations libres.

Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  •  Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
/*<pre>*/
// END Enable multiple onload functions
// ============================================================
function addLoadEvent(func) 
{
  if (window.addEventListener) 
    window.addEventListener("load", func, false);
  else if (window.attachEvent) 
    window.attachEvent("onload", func);
}
/*</pre>
==Ajouts==
<pre>*/


function addToSummary(str)
{
        document.editform.wpSummary.value += " " + str
}

function DeluxeSummary()
{
        var sumLbl = document.getElementById("wpSummaryLabel")
        if (sumLbl)
        {
                //élargissement boite de résumé
                var sumInput = document.getElementById("wpSummary")
                sumInput.style.width = "90%"

                var titles = new Array()
                titles.push("ébauche")
                titles.push("cat")
                titles.push("interwiki")
                titles.push("int")
                titles.push("ext")
                titles.push("corr interwiki")
                titles.push("corr lien int")
                titles.push("corr lien ext")
                titles.push("ext -> int")
                titles.push("int -> interwiki")
                titles.push("MeP")
                titles.push("fusion")
                titles.push("redir")
                titles.push("ortho/gram")
                titles.push("retouches")
                titles.push("ajInfo ")
                titles.push("citation")
                titles.push("source")
                titles.push("création")
                titles.push("Avis")
                titles.push("Motivation")
                titles.push("Réponse")
                titles.push("régul")
                titles.push("délais")
                titles.push("sup copyvio")
                titles.push("date")
                titles.push("rv-motif")


                var inputs = new Array()
                inputs.push("- bandeau ébauche")
                inputs.push("- catégorie")
                inputs.push("- liens interwiki")
                inputs.push("- lien interne")
                inputs.push("- lien externe")
                inputs.push("correction liens interwiki")
                inputs.push("correction lien interne")
                inputs.push("correction lien externe")
                inputs.push("conversion lien externe en lien interne")
                inputs.push("conversion lien interne en lien interwiki")
                inputs.push("mise en page")
                inputs.push("fusion")
                inputs.push("Redirect")
                inputs.push("correction orthographe/grammaire")
                inputs.push("diverses retouches")
                inputs.push("ajout infos")
                inputs.push("ajout d\\'une citation")
                inputs.push("ajout d\\'une source")
                inputs.push("Initialisation de la page")
                inputs.push("Avis rendu !")
                inputs.push("Ma motivation")
                inputs.push("Réponse")
                inputs.push("- non régularisé")
                inputs.push("- délais non respectés")
                inputs.push("- suppression passage en copyvio du site : ")
                inputs.push("- du "+ TodayDate())
                inputs.push("revert de la dernière contribution. Indiquez les motifs des modifications dans boîte de résumé ou en indiquer le renvoi en page de discussion")

                var str = ""
                for (var cpt = 0; cpt < titles.length; cpt ++)
                {
                        str += "<a href=\"javascript:addToSummary('" + inputs[cpt] + "')\""
                                + " class=\"sumLink\" title=\"Ajouter '" + inputs[cpt] +"' dans la boîte de résumé\">"
                                + titles[cpt]
                                + " ·</a> "
                }
                sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML
        }
}

addLoadEvent(DeluxeSummary)

/*</pre>
==Barre d'édition de boutons==
<pre>*/

function DeluxeBar() {
  if (document.createTextNode) {
        var toolbar = document.getElementById("toolbar"); 
        if (!toolbar) return;
        

        var messages = new Array()
        var images = new Array()
        var commentaires = new Array()
        var a=-1;

//Le décompte commence à -1 avec une incrementation sur le premier message, pour éviter tout probleme en cas d'inversion ou suppression du premier message

        // le texte a été splitté sinon Mediawiki casse tout...

        messages[++a] = "{{subst:" + "Bienvenue" + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/e/eb/Button_accueilB.png";
        commentaires[a] = "Bienvenue !"

        messages[++a] = "{{subst:" + "Merci IP" + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/a/a9/Button_tournesol.png";
        commentaires[a] = "Merci pour ta contribution"

        messages[++a] = "{{subst:"+ "bienvenue IP" + "}}" + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/3/39/Button_IP.png";
        commentaires[a] = "Bienvenue !"

        messages[++a] = "{{subst:" + "motivation modif" +"|page=" + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png";
        commentaires[a] = "Modification de page sans motif"

        messages[++a] = "{{"+ "subst:bienvenue débutant" + "}}" + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/2/28/Button_info.png";
        commentaires[a] = "Bienvenue débutant !"

        messages[++a] = "{{subst:" + "Bienvenue vandale" + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/0/00/Button_vandale.png";
        commentaires[a] = "Avertissement vandalisme"

        messages[++a] = "{{subst:" + "Vandalisme| " + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/1/1d/Bouton_Vandale1.png";
        commentaires[a] = "Avertissement vandalisme" + " de niveau 1 "

        messages[++a] = "{{subst:" + "Bienvenue spammeur" + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/f/fb/Button_spam2.png";
        commentaires[a] = "Avertissement spam " 

        messages[++a] = "{{subst:" + "vandale bloqué\\n\|1=\\n\|2=" + "}}" +  "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/b/b0/Button_blocage.png";
        commentaires[a] = "Avis de blocage  " 

        messages[++a] = "{{subst:" + "Traité||--" + "~~" + "~~" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/d/d9/Button_trait%C3%A9.png";
        commentaires[a] = "Traité"

        messages[++a] = "{{subst:" + "TraitéConserver||--" + "~~" + "~~" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/a/ae/Button_trait%C3%A9conserver.png";
        commentaires[a] = "Traité : article conservé"

        messages[++a] = "{{subst:" + "TraitéSupprimer||--" + "~~" + "~~" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/9/96/Button_trait%C3%A9supprimer.png";
        commentaires[a] = "Traité : article supprimé"

        messages[++a] = "{{" + "suppression" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/f/f8/Button_suppr.png";
        commentaires[a] = "Proposé à la suppression" 

        messages[++a] = "#{{supprimer" + "}} " + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/f/fc/Button_supp.png";
        commentaires[a] = "/*Supprimer*/A voté !";

        messages[++a] = "#{{conserver" + "}} " + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/b/ba/Button_conserver.png";
        commentaires[a] = "/*Conserver*/A voté !"

        messages[++a] = "#{{neutre" + "}} " + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/4/4e/Button_neutre.png";
        commentaires[a] = "/*neutre*/Vote réservé !"

        messages[++a] = "#{{pour" + "}} " + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/b/ba/Button_conserver.png";
        commentaires[a] = "/*Pour*/A voté !"

        messages[++a] = "#{{contre" + "}} " + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/f/fc/Button_supp.png";
        commentaires[a] = "/*Contre*/A voté !"

        messages[++a] = ":"+ "{{" + "fait" + "}}" + " --" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/9/9d/Button_fait.png";
        commentaires[a] = "traité "

        messages[++a] = "{{" + "à sourcer" + "|date=" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png";
        commentaires[a] = "Citation non sourcée "

        messages[++a] = "{{" + "Réf absente" + "| " + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png";
        commentaires[a] = "Citation non sourcée "

        messages[++a] = "{{" + "Réf imprécise" + "| " + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/6/6d/Button_exclamation_1.png";
        commentaires[a] = "Citation avec référence incomplète ou imprécise "

        messages[++a] = "{{" + "Avertissement source|page=" + "}}" + "--" + "~~" + "~~";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/6/6a/Button_exclamation_2.png";
        commentaires[a] = "Avis d'article non sourcé "

        messages[++a] = "{{" + "subst:Citation du jour/Préchargement" + "\\n|citation=\\n|auteur=\\n|article=\\n" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/7/74/Button_comment.png";
        commentaires[a] = "Nouvelle citation du jour "

        messages[++a] = "{{" + "Fiche de référence" + "\\n|1=\\n" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/f/f0/Btn_infotexto.png";
        commentaires[a] = "Fiche de référence du livre "

        messages[++a] = "{{" + "Choisie citation du jour\\n|puce=*\\n|année=2012\\n|mois=\\n|jour=\\n|commentaire=\\n" + "}}\\n";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/a/a5/Button_uses.png";
        commentaires[a] = "Choisie comme citation du jour"

      ////////////////////////////////

for (var i=0;i<messages.length;i++) {
                var img = document.createElement("img");
                img.setAttribute("src", images[i]);
                
                var ref = document.createElement("a");
                ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" + 
                                 "javascript:changeSummary(\"" + commentaires[i] + "\");" ); 
                ref.appendChild(img); 
                
                toolbar.appendChild(ref);
        }
  }
}

function changeSummary(sampleText) {
        document.editform.wpSummary.value = sampleText;
}

addLoadEvent(DeluxeBar);

/*</pre>
==Meilleur suivi==
<pre>*/


function insertAfter(parent, node, referenceNode) {
    parent.insertBefore(node, referenceNode.nextSibling);
}

function OptimizedSuivi() 
{
        if (document.URL.indexOf("http://fr.wikiquote.org/wiki/Special:Watchlist")==0 ||
        document.URL.indexOf("http://fr.wikiquote.org/w/index.php?title=Special:Watchlist")==0 ){
                
                var allDays = document.getElementsByTagName("ul");
                
                for (i=0; i<allDays.length; i++) {
                        if (allDays[i].getAttribute("class") == "special") {
                                
                                var artList = allDays[i].getElementsByTagName("li");
                                for (j=0; j<artList.length; j++) {
                                        var elem = artList[j];
                                        var aTag = elem.getElementsByTagName("a");
                                        var articleName = aTag[0].getAttribute("title");
                                        var stopWatch  = "/w/index.php?title=" + articleName + "&action=unwatch"
                                    
                                        var newElement = document.createElement("a");
                                        newElement.setAttribute("href",stopWatch);
                                        var newText = document.createTextNode("stop");
                                        newElement.appendChild(newText);

                                        var newPar = document.createTextNode(") (")
                                        // séparation des cas (nouvel article, ou déjà existant)
                                        if (aTag[0].childNodes[0].data == "diff") {
                                                insertAfter(elem, newPar, aTag[1]); 
                                        } else {
                                                insertAfter(elem, newPar, aTag[0]); 
                                        }
                                        
                                        insertAfter(elem, newElement, newPar);
                                }       
                        }
                }
        }
}

addLoadEvent(OptimizedSuivi);

function nouvelOnglet() {
  var a = document.getElementById("p-cactions");
        if (a) 
        {
          b = a.getElementsByTagName("ul");
          if(b.length > 0)
          {
            b[0].innerHTML = b[0].innerHTML
            + '<li id="ca-nstab-user">'
            + '<a href="/wiki/Special:Shortpages">'
            + 'shortpages</a></li>';
          }
        }
      }
      
addLoadEvent(nouvelOnglet);


/*</pre>
==Ajouts de lien externes et internes dans la barre de navigation de gauche==
<pre>*/

function OptimizedNavig() 
{
  var a = document.getElementById("p-navigation");

  if (a) 
  {
    b = a.getElementsByTagName("ul");
    if(b.length > 0)
    { 
      var startUrl = '/w/index.php?title='
      var endUrl = '&action=purge'

      // liste des URLs
      var urls = new Array()

      urls[0] = 'Wikiversité:Pages à supprimer'
      urls[1] = 'Special:Export'
      urls[2] = 'Special:Newpages'
      urls[3] = 'Special:Blockip'
      urls[4] = 'Special:Log/delete'
      urls[5] = 'Wikiquote:Requête aux bureaucrates'
      urls[6] = 'Wikiquote:Maintenance'
      urls[7] = 'Special:Import'
      urls[8] = 'w:Special:Import'
      urls[9] = 's:Special:Import'
      urls[10] = 'wikt:Special:Import'
      urls[11] = 'n:Special:Import'
      urls[12] = 'b:Special:Import'	
      urls[13] = 'v:Special:Import'
      urls[14] = 'MediaWiki:Common.js'
      urls[15] = 'MediaWiki:Edittools'


      var labels = new Array()

      labels[0] = 'PàS'
      labels[1] = 'Export'
      labels[2] = 'nPage'
      labels[3] = 'Block'
      labels[4] = 'Log/Del'
      labels[5] = 'Bureaucrate'
      labels[6] = 'Maintenance'
      labels[7] = 'Import'
      labels[8] = 'w:Import'
      labels[9] = 's:Import'
      labels[10] = 'wikt:Import'
      labels[11] = 'n:Import'
      labels[12] = 'b:Import'
      labels[13] = 'v:Import'
      labels[14] = 'Common'
      labels[15] = 'Edittools'


      for (var i=0;i<urls.length;i+=2) {
        tableHTML = '<table valign="top" cellspacing="0" cellpadding="0" style="font-size:0.75em";>'
        tableHTML += '<tr>'
        tableHTML += '<li><td><a href="' + startUrl + urls[i] + endUrl + '">' + labels[i] + ' | </a></td>'
        tableHTML += '<td><a href="' + startUrl + urls[i+1] + endUrl + '">' + labels[i+1] + '</a></td></li>'
        tableHTML += '</tr>'
        tableHTML += '</table>' 
        b[0].innerHTML = b[0].innerHTML + tableHTML
      }

    }
  }
}

addLoadEvent(OptimizedNavig);

/*</pre>
==Optimise le suivi==
<pre>*/

//OPTIMISE LE SUIVI
//Auteur : ?
//Version/Date : ?
function OptimizedSuivi() 
{
  if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Watchlist")==0 ||
      document.URL.indexOf("http://fr.wikipedia.org/w/index.php?title=Special:Watchlist")==0) {
                
    var allDays = document.getElementsByTagName("ul");          
    for (i=0; i<allDays.length; i++) {
       if (allDays[i].getAttribute("class") == "special") {
  
          var artList = allDays[i].getElementsByTagName("li");
          for (j=0; j<artList.length; j++) {
             var elem = artList[j];
             var aTag = elem.getElementsByTagName("a");
             var articleName = aTag[0].getAttribute("title");
             var stopWatch  = "/w/index.php?title=" + articleName + "&action=unwatch"
                            
             var newElement = document.createElement("a");
             newElement.setAttribute("href",stopWatch);
             var newText = document.createTextNode("stop");
             newElement.appendChild(newText);

             var newPar = document.createTextNode(") (")
             // séparation des cas (nouvel article, ou déjà existant)
             if (aTag[0].childNodes[0].data == "diff") {
                insertAfter(elem, newPar, aTag[1]); 
             } else {
                insertAfter(elem, newPar, aTag[0]); 
             }
                                        
             insertAfter(elem, newElement, newPar);
          }       
       }
    }
  }
}

/*</pre>
== Outils à destination des Administrateurs ==
<pre>*/

/*</pre>
=== SuppressionDeluxe : Rajout de boutons de motif de suppression ===
<pre>*/



function SuppressionDeluxe() {
	if (document.title.indexOf("Confirmer la suppression")!=0) return; 
	var mainNode = document.getElementsByTagName("form");
	var firstForm = mainNode[0];
	var messages = new Array();
	var ca = 0;
	messages[ca++] = "Violation de copyright";
	messages[ca++] = "Page non sourcée";
	messages[ca++] = "Sources insuffisantes";
	messages[ca++] = "Publicité ou autopromotion";
	messages[ca++] = "Vandalisme";
	messages[ca++] = "Redirection vers une page inexistante";
	messages[ca++] = "Supprimé à la demande de son auteur";
	messages[ca++] = "Traduction automatique";
	messages[ca++] = "Contrevient aux règles de nommage";
	messages[ca++] = "Propos blessants ou insultes";
	messages[ca++] = "Spam";
	messages[ca++] = "Ne respecte pas les critères d'admissibilité";
	messages[ca++] = "Fusion des historiques";
	messages[ca++] = "Transwiki terminé";

	var table = document.createElement("table");
	var tr = document.createElement("tr");
	table.appendChild(tr);
	if (firstForm.getAttribute("id")=="deleteconfirm") {
		actionDelete = firstForm.getAttribute("action");
		var inputs = firstForm.getElementsByTagName("input");
		var token = inputs[2].getAttribute("value"); 
		for (var i=0;i<messages.length;i++) {
			if (i%3==0) {
				tr = document.createElement("tr");
				table.appendChild(tr);
			}
			var formElement = document.createElement("form");
			formElement.setAttribute("id", "deleteconfirm");
			formElement.setAttribute("method", "post");
			formElement.setAttribute("action", actionDelete);
			var inputReason = document.createElement("input");
			inputReason.setAttribute("name", "wpReason"); 
			inputReason.setAttribute("value", messages[i]); 
			inputReason.setAttribute("type", "hidden"); 
			var inputConfirm = document.createElement("input");
			inputConfirm.setAttribute("name", "wpConfirmB"); 
			inputConfirm.setAttribute("value", messages[i]); 
			inputConfirm.setAttribute("type", "submit"); 
			var inputToken = document.createElement("input");
			inputToken.setAttribute("name", "wpEditToken"); 
			inputToken.setAttribute("value", token); 
			inputToken.setAttribute("type", "hidden"); 
			formElement.appendChild(inputReason);
			formElement.appendChild(inputConfirm);
			formElement.appendChild(inputToken);
			var td = document.createElement("td");
			td.appendChild(formElement);
			tr.appendChild(td); 
		}
		var separation = document.createElement("p");
		separation.appendChild(document.createElement("hr"));
		insertAfter(firstForm.parentNode, separation, firstForm);
		insertAfter(firstForm.parentNode, table, separation);
	}
}
addLoadEvent(SuppressionDeluxe)


/*</pre>
=== BlocageDeluxe : Rajout de boutons prédéfinis pour justifier un blocage ===
<pre>*/
	

	function BlocageDeluxe() {
		if (document.title.indexOf("Bloquer une adresse IP ou un utilisateur")!=0) return; 
		var mainNode = document.getElementsByTagName("form");
		var firstForm = mainNode[0];
		var ca = 0;
		var messages = new Array();
		var duree = new Array();

		messages[ca] = "Vandale non averti mais voulant manifestement nuire";
		duree[ca++] = "2 hours";

		messages[ca] = "Vandale averti";
		duree[ca++] = "1 day";

		messages[ca] = "Récidiviste";
		duree[ca++] = "3 days";

		messages[ca] = "Multi-récidiviste";
		duree[ca++] = "2 weeks"

		messages[ca] = "Identifiant à caractère injurieux";
		duree[ca++] = "infinite";

		messages[ca] = "Robot fou";
		duree[ca++] = "infinite";

		messages[ca] = "Spammeur";
		duree[ca++] = "infinite";

		var table = document.createElement("table");
		var tr = document.createElement("tr");
		table.appendChild(tr);
		if (firstForm.getAttribute("id")=="blockip") {
			actionBlock = firstForm.getAttribute("action");
			var inputs = firstForm.getElementsByTagName("input");
			var token = inputs[4].getAttribute("value");
			var lePauvre = inputs[0].getAttribute("value");
			for (var i=0;i<messages.length;i++) {
				//   if (i%3==0) {
				tr = document.createElement("tr");
				table.appendChild(tr);
				//   }
				var formElement = document.createElement("form");
				formElement.setAttribute("id", "blockip");
				formElement.setAttribute("method", "post");
				formElement.setAttribute("action", actionBlock);
				var inputReason = document.createElement("input");
				inputReason.setAttribute("name", "wpBlockReason"); 
				inputReason.setAttribute("value", messages[i]); 
				inputReason.setAttribute("type", "hidden"); 
				var dureeC = document.createElement("input");
				dureeC.setAttribute("name", "wpBlockExpiry"); 
				dureeC.setAttribute("value", "other"); 
				dureeC.setAttribute("type", "hidden");
				var dureeC2 = document.createElement("input");
				dureeC2.setAttribute("name", "wpBlockOther"); 
				dureeC2.setAttribute("value", duree[i]); 
				dureeC2.setAttribute("type", "text");
				var inputConfirm = document.createElement("input");
				inputConfirm.setAttribute("name", "wpBlock"); 
				inputConfirm.setAttribute("value", messages[i]); 
				inputConfirm.setAttribute("type", "submit");
				var ident = document.createElement("input");
				ident.setAttribute("name", "wpBlockAddress"); 
				ident.setAttribute("value", lePauvre); 
				ident.setAttribute("type", "hidden"); 
				var inputToken = document.createElement("input");
				inputToken.setAttribute("name", "wpEditToken"); 
				inputToken.setAttribute("value", token); 
				inputToken.setAttribute("type", "hidden"); 
				formElement.appendChild(inputReason);
				formElement.appendChild(dureeC);
				formElement.appendChild(dureeC2);
				formElement.appendChild(inputConfirm);
				formElement.appendChild(inputToken);
				formElement.appendChild(ident);
				var td = document.createElement("td");
				td.appendChild(formElement);
				tr.appendChild(td); 
			}
			var separation = document.createElement("p");
			separation.appendChild(document.createElement("hr"));
			insertAfter(firstForm.parentNode, separation, firstForm);
			insertAfter(firstForm.parentNode, table, separation);
		}
	}
addLoadEvent(BlocageDeluxe);


/*</pre>
=== UndeleteSelectAll : Tout sélectionner ou déselectionner pour la restauration d'une page ===
<pre>*/



function UndeleteSelectAll()
{
	if (document.title.indexOf("Voir et restaurer la page supprimée")!=0) return;
	var title2 = document.getElementsByTagName("h2");
	var all = document.createElement("input");
	all.setAttribute("type", "checkbox");
	all.setAttribute("onchange", "selectAll(this.checked)");
	all.setAttribute("title", "Sélectionner/Désélectionner tous");
	if (title2.length > 1)
		title2[1].appendChild(all);
	else
		title2[0].appendChild(all);
	all.click();
}
function selectAll(bool)
{
	var inputs = document.getElementsByTagName("input");
	for (var cpt = 0 ; cpt < inputs.length ; cpt++)
	{
		inputs[cpt].checked = bool;
	}
}
addLoadEvent(UndeleteSelectAll);

/*</pre>
=== Navigation Pop-ups ===
<pre>*/


document.write('<script type="text/javascript" src="' 
		+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
		+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="' 
		+ 'http://fr.wikipedia.org/w/index.php?title=User:Leag/popups-strings-fr.js' 
		+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
simplePopups=true;
popupStructure='menus';
popupDelay=0;
popupAdminLinks=true;
popupImages=false;
popupMaxWidth=false;
popupOnlyArticleLinks=false;
popupMaxWidth=false;

/*</pre>
== Fonction TodayDate ==
<pre>*/


function TodayDate()
{
        var m = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre")
        var today = new Date()
        var day = today.getDate()
        var year = today.getYear()

        if (year < 2000)
                year += 1900

        return (day + " " + m[today.getMonth()] + " " + year)
}

/* </pre>

== bouton Remplacement ==

<pre> */

/***
	*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 {	
                        editbox = document.getElementById('wpTextbox1');
			/* container */
			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');
		        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');
			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 */
		editbox.value = editbox.value.replace(search,replace);
 
	}
 
	/* remove form */
	function customremove() {
		regexform.parentNode.removeChild(regexform);
		patterncount = -1;
	}
 
 
	/*******************
	*** create button
	********************/
        function add_regexp_button(){
 
             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)


/*</pre>*/