Utilisateur:El-fafa/monobook.js

Un article de Wikipédia, l'encyclopédie libre.

Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.

function disambiguationHook ()
 {
 var toto = document.title;
 // le texte de l'homonymie
 var old_text = "client";
 // la nouvelle description de l'homonymie
 var new_text = "client (Rome)";
 if (toto.match(/^modification/)) {
        var text = document.getElementById("wpTextbox1");
    var index = 0;
    remplace = false;
    while (true) {
   var position = text.value.indexOf("["+old_text+"]",position);
        if (position == -1)
             break;
        var beginLine = text.value.lastIndexOf("\n",position);
        var endLine   =   text.value.indexOf("\n",position);
        if ( window.confirm("Remplacer dans "+text.value.substring(beginLine,endLine))) {
   var aremplacer = (text.value.substring(0,position)+ "[" + new_text +"|"+old_text + "]" +  text.value.substring(position+2+old_text.length)  ); 
   text.value = aremplacer;
    remplace = true;
        }
        position +=1;
    }
    if (remplace) {
    document.getElementById("wpSummary").value ="Correction des [[Wikipédia:Projet/Liens vers les pages d'homonymie|liens vers les pages d'homonymie]] ("+new_text+")" 
    }
 } 
 }
 // addLoadEvent( disambiguationHook ) ;