This is an archive copy of wikilivres.ca as of 18 February 2017 (from the WikiTeam dump). The original site is closed.

MediaWiki:Common.js: Difference between revisions

Free texts and images.
Jump to navigation Jump to search
imported>Yann
New page: →******************** Indicateurs de qualité Auteur: ThomasV ********************: function pageQuality() { var a = document.getElementById("ca-nstab-main"); if(wgCanonicalNamespace...
 
Archive copy: scripts and images from the old wikilivres.ca domain (now third-party) and wikisource.org moved to ca.wikilivres.ru over https
 
(72 intermediate revisions by 8 users not shown)
Line 1: Line 1:
/*********************
Indicateurs de qualité
Auteur: ThomasV
*********************/


/* <pre> */
/**********************
*** Quality indicators on "article" tab
*** by [[user:ThomasV]]
**********************/
// return src for icon given percentage
function icon_src(t){
var src='https://ca.wikilivres.ru/images/';
switch(t){
case '0%': src+='8/8f/00%25.png'; break;
case '25%': src+='5/5b/25%25.png'; break;
case '50%': src+='3/3a/50%25.png'; break;
case '75%': src+='c/cd/75%25.png'; break;
case '100%': src+='6/64/100%25.png'; break;
case 'Validated': src+='b/b7/Etoile.png'; break;
}
return src;
}
// add indicator
function pageQuality() {
function pageQuality() {
 
var a = document.getElementById('ca-nstab-main');
var a = document.getElementById("ca-nstab-main");
if(wgCanonicalNamespace == "Page") a = document.getElementById("ca-nstab-page");
if(wgCanonicalNamespace == "Livre") a = document.getElementById("ca-nstab-livre");
if(!a) return;
if(!a) return;
 
var q = document.getElementById("textquality")
var pr_index = document.getElementById('pr_index');
if( q ) {
if(pr_index) return;
var t = q.className;
var new_img = document.createElement("img");
var q = document.getElementById('textquality');
new_img.setAttribute("src", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
if(q) {
new_img.setAttribute("title", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
var new_img = document.createElement('img');
new_img.setAttribute('src', icon_src(q.className));
a.firstChild.appendChild(new_img);
a.firstChild.appendChild(new_img);
}
}
if( document.getElementById("Author") ) a.firstChild.innerHTML = "Auteur";       
for(
var i=0;
spanElem = document.getElementsByTagName("span")[i];
i++
) {
if (spanElem.className == "pagequality")  {
t = spanElem.title;
var new_img = document.createElement("img");
new_img.setAttribute("src", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
new_img.setAttribute("title", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
   
   
if(wgCanonicalNamespace == "Page") {
for(var i=0; spanElem = document.getElementsByTagName('span')[i]; i++) {
a.firstChild.appendChild(new_img);
if (spanElem.className == 'pagequality')  {
}
var new_img = document.createElement('img');
else {
new_img.setAttribute('src', icon_src(spanElem.title));
s1 = spanElem.parentNode.previousSibling;
opttext = s1.firstChild.firstChild;
if(wgCanonicalNamespace == 'Page') {
img = opttext.firstChild.nextSibling.nextSibling.nextSibling;
a.firstChild.appendChild(new_img);
next = img.nextSibling;
}
opttext.removeChild(img);
else {
opttext.insertBefore(new_img,next);
s1 = spanElem.parentNode.previousSibling;
opttext = s1.firstChild.firstChild;
img = opttext.firstChild.nextSibling.nextSibling.nextSibling;
next = img.nextSibling;
opttext.removeChild(img);
opttext.insertBefore(new_img,next);
}
}
}
}
}
  }
}
}
addOnloadHook(pageQuality);
/* configure */
self.proofreadpage_add_container = true;
self.proofreadpage_disable_wheelzoom = false;
   
   
addOnloadHook(pageQuality);
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
/* importScriptURI('https://wikisource.org/w/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript'); */
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript');
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript');
 
/* Version ''correcte du script mais qui ne fonctionne pas, la version de jquery est trop ancienne */
/*importScriptURI('https://wikisource.org/w/index.php?title=MediaWiki:MatchSplit.js&action=raw&ctype=text/javascript');*/
/* Version de remplacement */
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:MatchSplit.js&action=raw&ctype=text/javascript');
 
 
/********************************************
*** New buttons on toolbar box
*** by [[user:ThomasV]]
********************************************/
 
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText) {
      mwCustomEditButtons[mwCustomEditButtons.length] =
        {"imageFile": imageFile,
          "speedTip": speedTip,
          "tagOpen": tagOpen,
          "tagClose": tagClose,
          "sampleText": sampleText};
}
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png','Rayer','<s>','</s>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png','Énumération','\\n# élément 1\\n# élément 2\\n# élément 3','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png','Liste','\\n* élément A\\n* élément B\\n* élément C','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/8/8f/Button_poeme.png','Poésie','<poem>','</poem>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png','Galerie Photo','<gallery>\\n','\\n</gallery>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png','Commentaire','<!--','-->','Insérer votre commentaire');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png','Redirection','#REDIRECT \[\[','\]\]','nom de la destination');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png','Catégorie','\[\[Category:','\]\]','nom de la catégorie');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png','Texte centré','<center>','</center>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/e/e9/Button_headline2.png','paragraphe niveau 3','===','===','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png', 'Insérer un retrait',':','',':' );
addCustomButton('https://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png','Texte plus petit','<small>','</small>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/2/28/Bouton_noir.png','Texte plus grand','<big>','</big>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png','Exposant','<sup>','</sup>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/4/4b/Button_nbsp.png','Espace insécable','&nbsp\;','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/9/93/Button_sub_link.png','Lien vers sous-titre','\[\[Page\#','\]\]','Sub_page' );
addCustomButton('https://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png','Block quote','<blockquote style=&quot;border: 1px solid blue; padding: 2em;&quot;>\\n','\\n</blockquote>','Block quote');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png','Aller à la ligne','<br />','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/4/4b/Button_class_text.png', 'Paragraphe texte','<div class=\'text\'>','</div>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/7/78/Button_titre.png','Titre de page','\{\{Titre\|','\|\|\}\}','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/0/03/Button_chapitre.png','Titre de Chapitre','\{\{chapitre\|livre=','\|auteur=\|nrpartie=\|nrchapitre=\|TitreChapitre=\|commentaires=\}\}','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png','Ajoute une référence','<ref>','</ref>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/6/64/Buttonrefvs8.png','Liste des références','<references />','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c3/Button_travaux.png','Relecture','\{\{subst:Infoédit\|1=','\|2= \|3= \|4= \|5= \|6= \}\}','');
 
 
 
/********************************************
*** Copyright tab
*** by [[user:ThomasV]]
********************************************/
 
function ongletCopyright() {  // id created by Template:Licence. It should match Template:Licence parameters
        var a = document.getElementById("p-cactions");
        if (a)
        {
          b = a.getElementsByTagName("ul");
          if(b.length > 0)
          {
            if(document.getElementById("Creative Commons by-nc-sa"))
              { b[0].innerHTML = b[0].innerHTML
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Creative_Commons_by-nc-sa">'  // /wiki/Wikilivres:Creative Commons by-nc-sa
                + 'Copyright</a></li>';
              }
            else if(document.getElementById("Copyright-ONU"))
              { b[0].innerHTML = b[0].innerHTML
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Copyright-ONU">'  // /wiki/Wikilivres:Copyright-ONU
                + 'Copyright</a></li>';
              }
            else if(document.getElementById("Copyright-UNESCO"))
              { b[0].innerHTML = b[0].innerHTML
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Copyright-UNESCO">'  // /wiki/Wikilivres:Copyright-UNESCO
                + 'Copyright</a></li>';
              }
            else if(document.getElementById("GFDL"))
              { b[0].innerHTML = b[0].innerHTML
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Licence_GFDL">'  // /wiki/Wikilivres:Licence GFDL
                + 'Copyright</a></li>';
              }
          }
        }
}
     
addOnloadHook(ongletCopyright);
 
 
 
/*****************************************************************
*** Edittools: Menu for selecting subsets of special characters
***
******************************************************************/
 
function addCharSubsetMenu() {  // the options should match MediaWiki:Edittools
  var specialchars = document.getElementById('specialchars');
 
  if (specialchars) {
    var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
    menu += "<option>Wiki</option>";
    menu += "<option>Latin</option>";
    menu += "<option>Grec</option>";
    menu += "<option>Cyrillique</option>";
    menu += "<option>AHD</option>";
    menu += "<option>Allemand</option>";
    menu += "<option>Catalan</option>";
    menu += "<option>Croate</option>";
    menu += "<option>Espagnol</option>";
    menu += "<option>Espéranto</option>";
    menu += "<option>Estonien</option>";
    menu += "<option>Gallois</option>";
    menu += "<option>Hawaien</option>";
    menu += "<option>Hiéroglyphe</option>";
    menu += "<option>Islandais</option>";
    menu += "<option>Italien</option>";
    menu += "<option>Maltais</option>";
    menu += "<option>Pinyin</option>";
    menu += "<option>Polonais</option>";
    menu += "<option>Portugais</option>";
    menu += "<option>Rōmaji</option>";
    menu += "<option>Roumain</option>";
    menu += "<option>Scandinave</option>";
    menu += "<option>Serbe</option>";
    menu += "<option>Tchèque</option>";
    menu += "<option>Vieil anglais</option>";
    menu += "<option>Vietnamien</option>";
    menu += "<option>API</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);




/*
Interwikiextra
Auteur:ThomasV
*/


/*****************************************************************
*** interwikiExtra
*** by [[user:ThomasV]]
******************************************************************/


function interwikiExtra()  
function interwikiExtra()  
Line 63: Line 226:
   for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
   for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
       // if found a linkInfo span
       // if found a linkInfo span
       if(a.className == "interwiki-info") {
       if(a.className == "interwiki-info") { // class created by Template:Interwiki-info
         // iterate over all <li>-elements
         // iterate over all <li>-elements
         var count=0;
         var count=0;
Line 70: Line 233:
             if(b.className == "interwiki-" + a.id) {
             if(b.className == "interwiki-" + a.id) {
               b.innerHTML = b.innerHTML + " "+a.title;
               b.innerHTML = b.innerHTML + " "+a.title;
               if(a.title == "(vo)") { b.title = "Texte original"; }
               if(a.title == "(vo)") { b.title = "Original Text"; }
             }
             }
         else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
         else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
Line 80: Line 243:
         }
         }
       }
       }
       if(a.className == "AutreVersion") {
       if(a.className == "OtherVersion") {   // class created by Template:OtherVersion (Modèle:AutreVersion in fr.ws)
         p = a.title.indexOf("|");
         p = a.title.indexOf("|");
         pvers = document.getElementById("p-version");
         pvers = document.getElementById("p-version");
Line 87: Line 250:
           c.innerHTML = c.innerHTML
           c.innerHTML = c.innerHTML
             + "<div class=\"portlet\" id=\"p-version\">"
             + "<div class=\"portlet\" id=\"p-version\">"
             + "<h5>Autres versions</h5>"
             + "<h5>Other versions</h5>"
             + "<div class=\"pBody\">"
             + "<div class=\"pBody\">"
             + "<ul>"
             + "<ul>"
Line 98: Line 261:
             + "<li class=\"\"><a href='"  
             + "<li class=\"\"><a href='"  
             + a.title.substr(0,p)
             + a.title.substr(0,p)
             + "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>"
             + "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>";
       }
       }
   }
   }
Line 107: Line 270:




/*****************************************************************
*** footnotes as tooltip
*** from it.wikipedia.org
*** inserted by [[user:-jkb-]]
******************************************************************/


/*
addOnloadHook ( function ()
Liens bilingues
Fonctionne avec l'extension DoubleWiki.
Auteur: ThomasV
*/
 
 
function BilingualLink()  
{
{
    if( wgNamespaceNumber != 0) return;
sups = document.getElementsByTagName("sup");
    var doc_url = document.URL;
  for (i=0; i<sups.length; i++)
    var url = '';
  {
    // iterate over all <li>-elements
   note_id = sups[i].childNodes[0].href;
    for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
  if (note_id && (note_id.indexOf("#") != -1))
        if(b.className.substring(0,10) == "interwiki-" ) {
   {
              var lang = b.className.substring(10,b.className.length);
    note_id = document.getElementById(note_id.substr(note_id.indexOf("#")+1));
              if( doc_url.indexOf('?title=') != -1 ) {
    if (note_id)
                  var qm  = doc_url.indexOf('&match=');
       if (document.all)  
                  if( qm != -1 ) url = doc_url.substring(0,qm)+"&match="+lang;
      {  
                  else url = doc_url+"&match="+lang;
          sups[i].title = note_id.innerText;  
              } else {
          sups[i].childNodes[0].title = note_id.innerText;  
                  var qm = doc_url.indexOf('?');
      }  
                  if( qm != -1 ) url = doc_url.substring(0,qm)+"?match="+lang;
      else
                  else url = doc_url+"?match="+lang;
      {  
              }
           sups[i].title = note_id.textContent;  
              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);
 
 
function loadImage(ImageSrc,id){
 
  var d = document.getElementById(id);
  //if(d.firstChild){d.removeChild(d.firstChild);}
  d.firstChild.setAttribute('href', 'javascript:hideImage("'+ImageSrc+'", "'+id+'");');
  d.firstChild.setAttribute('title', 'cacher');
  d.firstChild.innerHTML='[-]';
  var newimg = document.createElement("img");
  //newimg.setAttribute("src", "/wiki/Special:Filepath/"+ImageSrc.substring(6));
  newimg.setAttribute("src", "/w/thumb.php?f="+ImageSrc.substring(6)+"&w=650");
  newimg.setAttribute("alt", "image not found : "+ImageSrc.substring(6));
  newimg.setAttribute("id", "img2");
  d.appendChild(newimg);
 
}
 
function hideImage(ImageSrc,id){
  var d = document.getElementById(id);
  d.firstChild.setAttribute('href', 'javascript:loadImage("'+ImageSrc+'", "'+id+'");');
  d.firstChild.setAttribute('title', 'montrer');
  d.firstChild.innerHTML='[+]';
  d.removeChild(d.lastChild);
}
 
 
function onclickImages() {
 
  // iterate over all < span >-elements
  for(
          var i=0;
           spanElem = document.getElementsByTagName("span")[i];
          i++
      ) {
        if (spanElem.className == "onclickImage")  {
            spanElem.setAttribute('id', 'onclick'+i);
            title = spanElem.firstChild.getAttribute('title');
            spanElem.firstChild.setAttribute('href', 'javascript:loadImage("'+title+'", "onclick'+i+'");');
            spanElem.firstChild.innerHTML='[+]';
            spanElem.firstChild.setAttribute('title', 'montrer');  
       }
       }
   }
   }
  }
  }
 
})
addOnloadHook(onclickImages);
 
 
 
/****
*Mode édition
*****/
 
if(wgAction=='edit' || wgAction=='submit') {
 
 
/*
*Boutons Qualité
*Auteur: ThomasV
*/
 
 
function addQuality(form,value){
var text="";
switch(value){
case "0%": text = "En projet"; break;
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;
}
 
form.elements["wpSummary"].value="/* "+text+" */";
s = form.elements["wpTextbox1"].value;
if(wgCanonicalNamespace == "Page") {
prefix="Page";
s = s.replace(/\{\{PageQuality\|(.*?)\}\}/gi,"")
}
else {
prefix="Text";
s = s.replace(/\{\{TextQuality\|(.*?)\}\}/gi,"")
}
form.elements["wpTextbox1"].value="{"+"{"+prefix+"Quality|"+value+"}"+"}"+s;
}
 
function addQualityButtons(){
if( wgNamespaceNumber != 0 && wgNamespaceNumber != 104 && wgNamespaceNumber != 112) return;
var ig  = document.getElementById("wpWatchthis");
if(ig) {
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"> 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 {
                        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)
 
/*
===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 (wgPageName == "Special:Search") {
        var searchEngines = [];
        addOnloadHook(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;
        }
        var searchForm = document.forms['search'];
        var selectBox = document.createElement('select');
        selectBox.id = 'searchEngine';
        searchForm.onsubmit = function() {
                var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
                searchForm.action = optSelected[0];
                searchForm.lsearchbox.name = optSelected[1];
                searchForm.title.value = optSelected[3];
                searchForm.title.name = optSelected[2];
        }
        selectBox.appendChild(createOption('Moteur interne', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search'));       
        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'));


        searchForm.lsearchbox.style.marginLeft = '0px';
/* </pre> */
        var lStat = document.getElementById('loadStatus');
        lStat.parentNode.insertBefore(selectBox, lStat);
}

Latest revision as of 20:19, 28 October 2026

/* <pre> */

/**********************
*** Quality indicators on "article" tab
*** by [[user:ThomasV]]
**********************/
// return src for icon given percentage
function icon_src(t){
	var src='https://ca.wikilivres.ru/images/';
	switch(t){
		case '0%': src+='8/8f/00%25.png'; break;
		case '25%': src+='5/5b/25%25.png'; break;
		case '50%': src+='3/3a/50%25.png'; break;
		case '75%': src+='c/cd/75%25.png'; break;
		case '100%': src+='6/64/100%25.png'; break;
		case 'Validated': src+='b/b7/Etoile.png'; break;
	} 
	return src;
}
 
// add indicator
function pageQuality() {
	var a = document.getElementById('ca-nstab-main');
	if(!a) return;
 
	var pr_index = document.getElementById('pr_index');
	if(pr_index) return;
 
	var q = document.getElementById('textquality');
	if(q) {
		var new_img = document.createElement('img');
		new_img.setAttribute('src', icon_src(q.className));
		a.firstChild.appendChild(new_img);
	}
 
	for(var i=0; spanElem = document.getElementsByTagName('span')[i]; i++) {
		if (spanElem.className == 'pagequality')  {
			var new_img = document.createElement('img');
			new_img.setAttribute('src', icon_src(spanElem.title));
 
			if(wgCanonicalNamespace == 'Page') {
				a.firstChild.appendChild(new_img);
			}
			else {
				s1 = spanElem.parentNode.previousSibling;
				opttext = s1.firstChild.firstChild;
				img = opttext.firstChild.nextSibling.nextSibling.nextSibling;
				next = img.nextSibling;
				opttext.removeChild(img);
				opttext.insertBefore(new_img,next);
			}
		}
	}
}
addOnloadHook(pageQuality);


/* configure */
self.proofreadpage_add_container = true;
self.proofreadpage_disable_wheelzoom = false;
 
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
/* importScriptURI('https://wikisource.org/w/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript'); */
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript');
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript');

/* Version ''correcte du script mais qui ne fonctionne pas, la version de jquery est trop ancienne */
/*importScriptURI('https://wikisource.org/w/index.php?title=MediaWiki:MatchSplit.js&action=raw&ctype=text/javascript');*/
/* Version de remplacement */
importScriptURI('https://ca.wikilivres.ru/index.php?title=MediaWiki:MatchSplit.js&action=raw&ctype=text/javascript');


/********************************************
*** New buttons on toolbar box
*** by [[user:ThomasV]]
********************************************/

function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText) {
      mwCustomEditButtons[mwCustomEditButtons.length] =
         {"imageFile": imageFile,
          "speedTip": speedTip,
          "tagOpen": tagOpen,
          "tagClose": tagClose,
          "sampleText": sampleText};
}

addCustomButton('https://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png','Rayer','<s>','</s>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png','Énumération','\\n# élément 1\\n# élément 2\\n# élément 3','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png','Liste','\\n* élément A\\n* élément B\\n* élément C','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/8/8f/Button_poeme.png','Poésie','<poem>','</poem>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png','Galerie Photo','<gallery>\\n','\\n</gallery>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png','Commentaire','<!--','-->','Insérer votre commentaire');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png','Redirection','#REDIRECT \[\[','\]\]','nom de la destination');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png','Catégorie','\[\[Category:','\]\]','nom de la catégorie');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png','Texte centré','<center>','</center>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/e/e9/Button_headline2.png','paragraphe niveau 3','===','===','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png', 'Insérer un retrait',':','',':' );
addCustomButton('https://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png','Texte plus petit','<small>','</small>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/2/28/Bouton_noir.png','Texte plus grand','<big>','</big>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png','Exposant','<sup>','</sup>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/4/4b/Button_nbsp.png','Espace insécable','&nbsp\;','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/9/93/Button_sub_link.png','Lien vers sous-titre','\[\[Page\#','\]\]','Sub_page' );
addCustomButton('https://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png','Block quote','<blockquote style=&quot;border: 1px solid blue; padding: 2em;&quot;>\\n','\\n</blockquote>','Block quote');
addCustomButton('https://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png','Aller à la ligne','<br />','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/4/4b/Button_class_text.png', 'Paragraphe texte','<div class=\'text\'>','</div>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/7/78/Button_titre.png','Titre de page','\{\{Titre\|','\|\|\}\}','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/0/03/Button_chapitre.png','Titre de Chapitre','\{\{chapitre\|livre=','\|auteur=\|nrpartie=\|nrchapitre=\|TitreChapitre=\|commentaires=\}\}','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png','Ajoute une référence','<ref>','</ref>','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/6/64/Buttonrefvs8.png','Liste des références','<references />','','');
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c3/Button_travaux.png','Relecture','\{\{subst:Infoédit\|1=','\|2= \|3= \|4= \|5= \|6= \}\}','');



/********************************************
*** Copyright tab
*** by [[user:ThomasV]]
********************************************/

function ongletCopyright() {  // id created by Template:Licence. It should match Template:Licence parameters
        var a = document.getElementById("p-cactions");
        if (a) 
        {
          b = a.getElementsByTagName("ul");
          if(b.length > 0)
          {
            if(document.getElementById("Creative Commons by-nc-sa"))
              { b[0].innerHTML = b[0].innerHTML 
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Creative_Commons_by-nc-sa">'   // /wiki/Wikilivres:Creative Commons by-nc-sa
                + 'Copyright</a></li>';
              }
            else if(document.getElementById("Copyright-ONU"))
              { b[0].innerHTML = b[0].innerHTML 
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Copyright-ONU">'   // /wiki/Wikilivres:Copyright-ONU
                + 'Copyright</a></li>';
              }
            else if(document.getElementById("Copyright-UNESCO"))
              { b[0].innerHTML = b[0].innerHTML 
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Copyright-UNESCO">'  // /wiki/Wikilivres:Copyright-UNESCO
                + 'Copyright</a></li>';
              }
            else if(document.getElementById("GFDL"))
              { b[0].innerHTML = b[0].innerHTML 
                + '<li id="ca-nstab-user">'
                + '<a href="https://fr.wikisource.org/wiki/Wikisource:Licence_GFDL">'  // /wiki/Wikilivres:Licence GFDL
                + 'Copyright</a></li>';
              }
          }
        }
}
      
addOnloadHook(ongletCopyright);



/*****************************************************************
*** Edittools: Menu for selecting subsets of special characters
*** 
******************************************************************/

function addCharSubsetMenu() {   // the options should match MediaWiki:Edittools
  var specialchars = document.getElementById('specialchars');

  if (specialchars) {
    var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
    menu += "<option>Wiki</option>";
    menu += "<option>Latin</option>";
    menu += "<option>Grec</option>";
    menu += "<option>Cyrillique</option>";
    menu += "<option>AHD</option>";
    menu += "<option>Allemand</option>";
    menu += "<option>Catalan</option>";
    menu += "<option>Croate</option>";
    menu += "<option>Espagnol</option>";
    menu += "<option>Espéranto</option>";
    menu += "<option>Estonien</option>";
    menu += "<option>Gallois</option>";
    menu += "<option>Hawaien</option>";
    menu += "<option>Hiéroglyphe</option>";
    menu += "<option>Islandais</option>";
    menu += "<option>Italien</option>";
    menu += "<option>Maltais</option>";
    menu += "<option>Pinyin</option>";
    menu += "<option>Polonais</option>";
    menu += "<option>Portugais</option>";
    menu += "<option>Rōmaji</option>";
    menu += "<option>Roumain</option>";
    menu += "<option>Scandinave</option>";
    menu += "<option>Serbe</option>";
    menu += "<option>Tchèque</option>";
    menu += "<option>Vieil anglais</option>";
    menu += "<option>Vietnamien</option>";
    menu += "<option>API</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);



/*****************************************************************
*** interwikiExtra
*** by [[user: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") {  // class created by Template: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 = "Original Text"; }
            }
         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 == "OtherVersion") {   // class created by Template:OtherVersion (Modèle:AutreVersion in fr.ws)
         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>Other 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);



/*****************************************************************
*** footnotes as tooltip
*** from it.wikipedia.org
*** inserted by [[user:-jkb-]]
******************************************************************/

addOnloadHook ( function ()
{
 sups = document.getElementsByTagName("sup");
 for (i=0; i<sups.length; i++)
 {
   note_id = sups[i].childNodes[0].href;
   if (note_id && (note_id.indexOf("#") != -1))
   {
     note_id = document.getElementById(note_id.substr(note_id.indexOf("#")+1));
     if (note_id)
       if (document.all) 
       { 
           sups[i].title = note_id.innerText; 
           sups[i].childNodes[0].title = note_id.innerText; 
       } 
       else 
       { 
           sups[i].title = note_id.textContent; 
      }
   }
 }
})




/* </pre> */