Pour pouvoir importer des images sur le serveur et consulter le wiki sans publicité, vous devez vous connecter.

Utilisateur:Add/monobook.js

Guild Wars Wiki en français
Aller à la navigation Aller à la recherche

Note : après avoir enregistré 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).
  • Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
  • Opera : appuyez sur Ctrl + F5.
/*
<pre>
<source lang="javascript"> */
 /** Extra toolbar options ******************************************************
  *
  *  Description: UNDOCUMENTED
  *  Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
  */
 
 //This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
 // This is based on the original code on Wikipedia:Tools/Editing tools
 // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
 
 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://bodin.samuel.free.fr/extensions/AddButtonExtension/Button_ebauche.jpg",
     "speedTip": "2bauche",
     "tagOpen": "{{Construction}}",
     "tagClose": "",
     "sampleText": ""};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://bodin.samuel.free.fr/extensions/AddButtonExtension/Button_center.jpg",
     "speedTip": "Centrer",
     "tagOpen": "<center>",
     "tagClose": "</center>",
     "sampleText": "Texte centré"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
     "speedTip": "Sauté une ligne",
     "tagOpen": "<br />",
     "tagClose": "",
     "sampleText": ""};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
     "speedTip": "Commentaire",
     "tagOpen": "<!-- ",
     "tagClose": " -->",
     "sampleText": "Commentaire"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://bodin.samuel.free.fr/extensions/AddButtonExtension/Button_gallery.jpg",
     "speedTip": "Gallery",
     "tagOpen": "\n<gallery>\n",
     "tagClose": "\n</gallery>",
     "sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"};
 
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
     "speedTip": "tableau",
     "tagOpen": '{| class="wikitable"\n|-\n',
     "tagClose": "\n|}",
     "sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"};



   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://bodin.samuel.free.fr/extensions/AddButtonExtension/Button_category.jpg",
     "speedTip": "Catégorie",
     "tagOpen": "[[Categorie: ",
     "tagClose": " ]]",
     "sampleText": ""};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://bodin.samuel.free.fr/extensions/AddButtonExtension/Button_headline.jpg",
     "speedTip": "Sous-titre 3",
     "tagOpen": "===",
     "tagClose": "===",
     "sampleText": "Sous-titre"};
 
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
     "speedTip": "Div",
     "tagOpen": '<div style="margin:0; background-color:#;  font-size:100%;  font-weight:bold;  border:1px solid #00000; text-align:left; color:#000; padding:0em 0em;">',
     "tagClose": "</div>",
     "sampleText": ""};
 }
// Installe wikEd pour l'édition des pages (pour tous)

// install the French translation for [[en:User:Cacycle/wikEd]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Leag/wikEd-fr.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// install [[User:Pilaf/Live_Preview]] page preview tool
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


var wikEdRegExTypoFix = true;
var wikEdRegExTypoFixURL = 'http://fr.wikipedia.org/wiki/Wikipédia:AutoWikiBrowser/Typos?action=raw';
var wikEdFullScreenModePreset = false;
var wikEdCloseToolbarPreset = true;


// install [[User:Cacycle/wikEd]] editing page extension
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// Add date and time to your monobook "personal menu" list at the very top of the page.
// Created by [[User:Mathwiz2020]]

// Indicate where you would like the time to appear:
// 1 is first (before username), 2 is second (before talk link), ... 7 is last (after log out link)
insertBeforeNum = 7;

// Do NOT edit below this line unless you're experiened in javascript
insertBeforeArr = new Array("","pt-userpage","pt-mytalk","pt-preferences","pt-watchlist","pt-mycontris","pt-logout","");
insertBefore = insertBeforeArr[insertBeforeNum];

function makeTime()
{
  var li = document.createElement( 'li' );
  li.id = 'pt-time';

  var mySpan = document.createElement( 'span' );
  mySpan.appendChild( document.createTextNode( 'date and time' ) );

  li.appendChild( mySpan );

  if ( insertBefore )
  {
    var before = document.getElementById( insertBefore );
    before.appendChild( li, before );
  }
  else // append to end (right) of list
  {
    document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
  }

  getTime();
}

if      ( window.addEventListener ) window.addEventListener ( 'load', makeTime, false );
else if ( window.attachEvent      ) window.attachEvent      ( 'onload', makeTime      );

function getTime()
{
    var time    = new Date();
    var date    = time.getUTCDate();
    var months  = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
        month   = months[time.getUTCMonth()];
    var year    = time.getUTCFullYear();
    var hours   = '0' + time.getUTCHours();
        hours   = hours.substr(hours.length-2, hours.length);
    var minutes = '0' + time.getUTCMinutes();
        minutes = minutes.substr(minutes.length-2, minutes.length);
    var seconds = '0' + time.getUTCSeconds();
        seconds = seconds.substr(seconds.length-2, seconds.length);
    var curTime = hours + ":" + minutes + ":" + seconds + ", " + date + " " + month + " " + year ;
    datePlace   = document.getElementById('pt-time').childNodes[0].childNodes[0];
                  datePlace.replaceData(0, datePlace.length, curTime);
    doTime      = window.setTimeout("getTime()", 1000);
}

/**
 * Ajoute des liens après les catégories pour rapidement
 * supprimer / modifier / ajouter une catégorie sur un article.
 * Utilise Ajax et l'api MediaWiki pour rechercher une catégorie.
 * Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]]
 * Auteur original : Magnus Manske
 * Adaptation pour WP:fr : Zelda
 * Paramètres personnalisables via le monobook :
 * - hotcat_autocommit : permet d'enregistrer automatiquement
 *   la modif sans repasser par la fenêtre d'édition
 * - hotcat_list_down : permet d'afficher la liste de suggestion
 *   vers le bas
 */
addOnloadHook ( hotcat ) ;

var hotcat_running = 0 ;
var hotcat_last_v = "" ;
var hotcat_exists_yes = "http://upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ;
var hotcat_exists_no = "http://upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ;

function hotcat () {
  if ( hotcat_check_action() ) return ; // Edited page, reloading anyway

  var catlinks = document.getElementById("catlinks");

  if (! catlinks && wgNamespaceNumber %2 == 0) { // all except discussion
   // let's create a fake one
   var bodyC = document.getElementById("bodyContent");
   catlinks = document.createElement("div");
   catlinks.id = "catlinks";
   catlinks.appendChild(document.createElement("p"));
   catlinks.firstChild.className = "catlinks";
   bodyC.appendChild(catlinks);
  }

  var catline = getElementsByClassName ( document , "p" , "catlinks" ) [0] ;

  if ( catline == null || typeof catline == 'undefined' ) return ;

  hotcat_modify_existing ( catline ) ;
  hotcat_append_add_span ( catline ) ;
}

function hotcat_append_add_span ( catline ) {
  var span_add = document.createElement ( "span" ) ;
  var span_sep = document.createTextNode ( " | " ) ;
  if ( catline.firstChild ) catline.appendChild ( span_sep ) ;
  catline.appendChild ( span_add ) ;
  hotcat_create_span ( span_add ) ;
}

String.prototype.ucFirst = function () {
   return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
}

function hotcat_modify_span ( span , i ) {
  var cat_title = span.firstChild.getAttribute ( "title" ) ;
  // Removing leading Category:
  cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
  var sep1 = document.createTextNode ( " " ) ;
  var a1 = document.createTextNode ( "(-)" ) ;
  var remove_link = document.createElement ( "a" ) ;
  remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\");" ;
  remove_link.appendChild ( a1 ) ;
  span.appendChild ( sep1 ) ;
  span.appendChild ( remove_link ) ;

  var mod_id = "hotcat_modify_" + i ;
  var sep2 = document.createTextNode ( " " ) ;
  var a2 = document.createTextNode ( "(±)" ) ;
  var modify_link = document.createElement ( "a" ) ;
  modify_link.id = mod_id ;
  modify_link.href = "javascript:hotcat_modify(\"" + mod_id + "\");" ;
  modify_link.appendChild ( a2 ) ;
  span.appendChild ( sep2 ) ;
  span.appendChild ( modify_link ) ;
}

function hotcat_modify_existing ( catline ) {
  var spans = catline.getElementsByTagName ( "span" ) ;
  for ( var i = 0 ; i < spans.length ; i++ ) {
    hotcat_modify_span ( spans[i] , i ) ;
  }
}

function hotcat_remove ( cat_title ) {
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  if (window.confirm("Voulez-vous vraiment supprimer la catégorie '" + cat_title + "' ?")) {
    document.location = editlk + '&hotcat_removecat=' + encodeURIComponent(cat_title) ;
  }
}

function hotcatGetParamValue(paramName, h) {
        if (typeof h == 'undefined' ) { h = document.location.href; }
        var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
        var m=cmdRe.exec(h);
        if (m) {
                try {
                        return decodeURIComponent(m[1]);
                } catch (someError) {}
        }
        return null;
}

function hotcat_check_action () {
  var ret = 0 ;
  if ( wgAction != "edit" ) return ret ; // Not an edit page, so no business...
  var summary = new Array () ;
  var t = document.editform.wpTextbox1.value ;
  var prevent_autocommit = 1 ;
  if ( typeof hotcat_autocommit != 'undefined' && hotcat_autocommit ) prevent_autocommit = 0 ;

  // Remove existing category?
  var hrc = hotcatGetParamValue('hotcat_removecat') ;
  // Add new category?
  var hnc = hotcatGetParamValue('hotcat_newcat') ;

  if ( typeof hrc != "undefined" && hrc != null && hrc != "" ) {
    var hcre = new RegExp("(\\s*)\\[\\[ *(?:Catégorie|Category) *: *" + hrc.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
    var matches = t.match(hcre);
    if (matches != null && matches.length == 1) { // Found one occurrence of the category - good!
      if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
        t = t.replace(hcre, "$1[[Catégorie:" + hnc + "$2]]");
        summary.push ( "Modification de la catégorie [[Catégorie:" + hrc + "]] → [[Catégorie:" + hnc + "]]" ) ;
      } else {
        t = t.replace(hcre, "");
        summary.push ( "Retrait de la catégorie [[Catégorie:" + hrc + "]]" ) ;
      }
      ret = 1 ;
    } else {
      alert ( "Impossible de trouver une occurrence unique de \"" + hrc + "\" - elle est peut-être incluse via un modèle" ) ;
      prevent_autocommit = 1 ;
    }
  } else {
    // Only adding?
    if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
      // Looking for last cat
      var re = /\[\[(?:Catégorie|Category):[^\]]+\]\]/ig
      var index = -1;
      while (re.exec(t) != null) index = re.lastIndex;
      var txt = "[[Catégorie:" + hnc + "]]" ;
      if (index < 0) {
        t = t + '\n' + txt ;
      } else {
        t = t.substring(0, index) + '\n' + txt + t.substring(index);
      }
      summary.push ( "Ajout rapide de la catégorie [[Catégorie:" + hnc + "]]" ) ;
      ret = 1 ;
    }
  }

  if ( ret ) {
    document.editform.wpTextbox1.value = t ;
    document.editform.wpSummary.value = summary.join( " ; " ) + " (avec [[MediaWiki:JSScripts/HotCats|HotCats]])" ;
    document.editform.wpMinoredit.checked = true ;
    if ( !prevent_autocommit ) {
      document.getElementById("bodyContent").style.display = "none" ; // Hiding the entire edit section so as not to tempt the user into editing...
      document.editform.wpSave.click();
    }
  }

  // This is the end, my friend, the end...
  return ret ;
}

function hotcat_clear_span ( span_add ) {
  while ( span_add.firstChild ) span_add.removeChild ( span_add.firstChild ) ;
}

function hotcat_create_span ( span_add ) {
  hotcat_clear_span ( span_add ) ;
  var a_add = document.createElement ( "a" ) ;
  var a_text = document.createTextNode ( "(+)" ) ;
  span_add.id = "hotcat_add" ;
  a_add.href = "javascript:hotcat_add_new()" ;
  a_add.appendChild ( a_text ) ;
  span_add.appendChild ( a_add ) ;
}

function hotcat_modify ( link_id ) {
  var link = document.getElementById ( link_id ) ;
  var span = link.parentNode ;
  var catname = span.firstChild.firstChild.data ;
  
  while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
  span.firstChild.style.display = "none" ;
  hotcat_create_new_span ( span , catname ) ;
  hotcat_last_v = "" ;
  hotcat_text_changed () ; // Update icon
}

function hotcat_add_new () {
  var span_add = document.getElementById ( "hotcat_add" ) ;
  hotcat_clear_span ( span_add ) ;
  hotcat_last_v = "" ;
  hotcat_create_new_span ( span_add , "" ) ;
}

function hotcat_create_new_span ( thespan , init_text ) {
  var form = document.createElement ( "form" ) ;
  form.method = "post" ;
  form.onsubmit = function () { hotcat_ok(); return false; } ;
  form.id = "hotcat_form" ;
  form.style.display = "inline" ;

  var list = document.createElement ( "select" ) ;
  list.id = "hotcat_list" ;
  list.onclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; } ;
  list.ondblclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; hotcat_ok(); } ;
  list.style.display = "none" ;

  var text = document.createElement ( "input" ) ;
  text.size = 40 ;
  text.id = "hotcat_text" ;
  text.type = "text" ;
  text.value = init_text ;
  text.onkeyup = function () { window.setTimeout("hotcat_text_changed();", 100 ); } ;

  var exists = document.createElement ( "img" ) ;
  exists.id = "hotcat_exists" ;
  exists.src = hotcat_exists_no ;

  var OK = document.createElement ( "input" ) ;
  OK.type = "button" ;
  OK.value = "OK" ;
  OK.onclick = hotcat_ok ;

  var cancel = document.createElement ( "input" ) ;
  cancel.type = "button" ;
  cancel.value = "Annuler" ;
  cancel.onclick = hotcat_cancel ;

  form.appendChild ( list ) ;
  form.appendChild ( text ) ;
  form.appendChild ( exists ) ;
  form.appendChild ( OK ) ;
  form.appendChild ( cancel ) ;
  thespan.appendChild ( form ) ;
  text.focus () ;
}

function hotcat_ok () {
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value ;

  // Empty category ?
  if ( v == "" ) {
    hotcat_cancel() ;
    return ;
  }

  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  var url = editlk + '&hotcat_newcat=' + encodeURIComponent( v ) ;

  // Editing existing?
  var span = text.parentNode.parentNode ; // span.form.text
  if ( span.id != "hotcat_add" ) { // Not plain "addition"
    var cat_title = span.firstChild.getAttribute ( "title" ) ;
    // Removing leading Category:
    cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
    url += '&hotcat_removecat=' + encodeURIComponent( cat_title ) ;
  }

  document.location = url ;
}

function hotcat_cancel () {
  var span = document.getElementById("hotcat_form").parentNode ;
  if ( span.id == "hotcat_add" ) {
    hotcat_create_span ( span ) ;
  } else {
    while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
    span.firstChild.style.display = "" ;
    for ( var i = 0 ; i < span.parentNode.childNodes.length ; i++ ) {
      if ( span.parentNode.childNodes[i] != span ) continue ;
      hotcat_modify_span ( span , i ) ;
      break ;
    }
  }
}

function hotcat_text_changed () {
  if ( hotcat_running ) return ;
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value.ucFirst() ;
  if ( hotcat_last_v == v ) return ; // Nothing's changed...

  hotcat_running = 1 ;
  hotcat_last_v = v ;

  if ( v != "" ) {
    var url = wgServer + "/" + wgScriptPath + "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent( v ) ;
    if ( typeof ( hotcat_xmlhttp ) != "undefined" ) hotcat_xmlhttp.abort() ; // Just to make sure...
    hotcat_xmlhttp = new sajax_init_object() ;
    hotcat_xmlhttp.open('GET', url, true);
    hotcat_xmlhttp.onreadystatechange = function () {
          if ( typeof hotcat_xmlhttp == "undefined" ) return ;
          if (hotcat_xmlhttp.readyState == 4) {
              var xml = hotcat_xmlhttp.responseXML ;
              if ( xml == null ) return ;
              var pages = xml.getElementsByTagName( "p" ) ;
              var titles = new Array () ;
              for ( var i = 0 ; i < pages.length ; i++ ) {
                var s = pages[i].getAttribute("title");
                // Removing leading "Category:"
                s = s.substr(s.indexOf(":") + 1);
                if ( s.substr ( 0 , hotcat_last_v.length ) != hotcat_last_v ) break ;
                titles.push ( s ) ;
              }
              hotcat_show_suggestions ( titles ) ;
          }
      };
    hotcat_xmlhttp.send(null);
  } else {
    var titles = new Array () ;
    hotcat_show_suggestions ( titles ) ;
  }
  hotcat_running = 0 ;
}

function hotcat_show_suggestions ( titles ) {
  var text = document.getElementById ( "hotcat_text" ) ;
  var list = document.getElementById ( "hotcat_list" ) ;
  var icon = document.getElementById ( "hotcat_exists" ) ;
  if ( titles.length == 0 ) {
    list.style.display = "none" ;
    icon.src = hotcat_exists_no ;
    return ;
  }
  
  var listh = titles.length * 20 ;
  var nl = parseInt ( text.parentNode.offsetLeft ) - 1 ;
  var nt = parseInt(text.offsetTop) - listh ;
  // Parameter to show suggestion list beneath categories instead of above
  if (typeof hotcat_list_down != "undefined" && hotcat_list_down) {
     nt = text.offsetTop + text.offsetHeight;
  }
  list.size = 5 ;
  list.style.align = "left" ;
  list.style.zIndex = 5 ;
  list.style.position = "absolute" ;
  list.style.top = nt + "px" ;
  list.style.width = text.offsetWidth + "px" ;
  list.style.height = listh + "px" ;
  list.style.left = nl + "px" ;
  while ( list.firstChild ) list.removeChild ( list.firstChild ) ;
  for ( var i = 0 ; i < titles.length ; i++ ) {
    var opt = document.createElement ( "option" ) ;
    var ot = document.createTextNode ( titles[i] ) ;
    opt.appendChild ( ot ) ;
    opt.setAttribute( "value", titles[i] );
    list.appendChild ( opt ) ;
  }
  
  list.style.display = "block" ;

  icon.src = hotcat_exists_yes ;

  var first_title = titles.shift () ;
  if ( first_title == hotcat_last_v ) return ;

  var nosel = hotcat_last_v.length ;
  
  text.value = first_title ;
  if( is_khtml )
   text.setSelectionRange( nosel, first_title.length );
  else
  {
   text.selectionStart = nosel ;
   text.selectionEnd = first_title.length ;
  }
}/*
  * '''QPreview'''
  * 
  * Permet une prévisualisation rapide sans recharger la page
  * Affiche : * le texte fournit par le serveur
              * les catégories et interwikis émulés en local
  * N'affiche pas : * la prévisualisation du résumé
                    * les modèles utilisés
                    * autres trucs rares comme les couleurs GeSHi (code de programmation coloré)
  * Attention : les catégories et interwikis sont émulés localement et peuvent parfois ne pas être corrects
  * (manquants s'ils sont inclus dans un modèle, affichés alors qu'ils sont dans un includeonly, etc.)
  * 
  * Auteur initial : [[:en:User:Alex Smotrov|en:Alex Smotrov]] sur [[:en:User:Alex Smotrov/qpreview.js]],
  *  complété par [[:fr:Utilisateur:Seb35|fr:Seb35]] pour afficher les interwikis et les catégories
  * Date de la dernière révision : 2 août 2007
  */

// 

function qPreviewButton()
{
 sauv = document.getElementById('wpSave');
 if(!sauv) return;
 if(!document.getElementById('p-lang'))
 {
  newDiv = document.createElement('div');
  newDiv.id = 'p-lang';
  newDiv.setAttribute('class', 'portlet');
  newDiv.style.display = 'none';
  newDiv.innerHTML = '<h5>Autres langues</h5><div class="pBody"><ul></ul></div>';
  toolbox = document.getElementById('p-tb');
  toolbox.parentNode.insertBefore(newDiv, toolbox.nextSibling);
 }
 if(!document.getElementById('catlinks'))
 {
  div = document.getElementsByTagName('div');
  for(i=0; i<div.length; i++)
  {
   if(div[i].className == 'printfooter')
   {
    newDiv = document.createElement('div');
    newDiv.id = 'catlinks';
    newDiv.style.display = 'none';
    div[i].parentNode.insertBefore(newDiv, div[i].nextSibling);
    break;
   }
  }
 }
 newBtn = document.createElement('input');
 newBtn.type = 'button';
 newBtn.value = 'QPreview';
 newBtn.onclick = qPreview;
 newBtn.id = 'btnQPreview';
 sauv.parentNode.insertBefore(newBtn, sauv.nextSibling);
}
addOnloadHook(qPreviewButton);

function qPreview()
{
 var qPreviewLanguage = wgServer.match(/.*\/\/(commons|incubator|meta|species|wikimediafoundation|www)/i) ? '' : wgServer.match(/.*\/\/([a-z-]*)\./i)[1];
 var divPreview = document.getElementById('wikiPreview');
 if (!divPreview) return;
 var btnQPreview = document.getElementById('btnQPreview');
 btnQPreview.value = 'Patience…';
 var qPreviewEnd = false;
 qPreviewTextbox = document.getElementById('wpTextbox1').value;
 if(document.editform.wpSection.value == 'new') qPreviewTextbox = '== '+document.editform.wpSummary.value+" ==\n"+qPreviewTextbox;
 qPreviewAjax1 = sajax_init_object();
 qPreviewAjax2 = sajax_init_object();
 
 // Traitement du texte
 qPreviewAjax1.open('POST', document.editform.action+'&live', true);
 Boundary = '--------p1415';
 qPreviewAjax1.setRequestHeader('Content-Type', 'multipart/form-data; boundary='+Boundary);
 PostData = '--' + Boundary
  + '\nContent-Disposition: form-data; name="wpTextbox1"\n\n'
  + qPreviewTextbox + '\n--'+Boundary;
 if (qPreviewAjax1.overrideMimeType) qPreviewAjax1.overrideMimeType('text/html');
 qPreviewAjax1.onreadystatechange = function()
 {
  if (qPreviewAjax1.readyState != 4) return;
  html = qPreviewAjax1.responseText;
  html = html.replace(/<br style="clear: both;" \/>/,'').replace(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'"').replace(/&amp;/g,'&').replace(/&apos;/g,"'");
  divPreview.innerHTML = html;
  if(qPreviewEnd) btnQPreview.value = 'QPreview';
  qPreviewEnd = true;
 };
 qPreviewAjax1.send(PostData);
 
 // Traitement des catégories
 reg1 = new RegExp(' ','g'); reg2 = new RegExp('\\|.*');
 regexCat = new RegExp('\\[\\[ *(?:Catégorie|Category) *: *(.*)\\]\\]', 'gi');
 qPreviewCat = qPreviewTextbox.match(regexCat);
 if(!qPreviewCat) { document.getElementById('catlinks').style.display = 'none'; if(qPreviewEnd) btnQPreview.value = 'QPreview'; qPreviewEnd = true; }
 else
 {
  qPreviewTemp = '';
  for(i=0;i<qPreviewCat.length;i++)
  {
   qPreviewCat[i] = 'Catégorie:'+qPreviewCat[i].replace(regexCat, '$1').replace(reg2, '');
   if(qPreviewCat[i] == 'Catégorie:') qPreviewCat.splice(i--, 1);
   else qPreviewTemp += qPreviewCat[i]+'|';
  }
  if(qPreviewTemp)
  {
   qPreviewAjax2.open('GET', wgServer+'/w/api.php?action=query&format=xml&prop=info&redirects&titles=' + qPreviewTemp.substr(0, qPreviewTemp.length-1), true);
   qPreviewAjax2.onreadystatechange = function()
   {
    if(qPreviewAjax2.readyState != 4) return;
    qPreviewTemp = '';
    xmlDoc = qPreviewAjax2.responseXML;
    normalized = xmlDoc.getElementsByTagName('normalized');
    if(normalized.length) normalized = normalized[0].getElementsByTagName('n');
    redirects = xmlDoc.getElementsByTagName('redirects');
    if(redirects.length) redirects = redirects[0].getElementsByTagName('r');
    pages = xmlDoc.getElementsByTagName('pages')[0].getElementsByTagName('page');
    for(i=0; i<qPreviewCat.length; i++)
    {
     cat = qPreviewCat[i];
     missing = false;
     redirect = false;
     for(j=0; j<normalized.length; j++) if(normalized[j].getAttribute('from') == cat) { cat = normalized[j].getAttribute('to'); break; }
     for(j=0; j<pages.length; j++) if(pages[j].getAttribute('title') == cat && pages[j].getAttribute('missing') == '') { missing = true; break; }
     for(j=0; j<redirects.length; j++) if(redirects[j].getAttribute('from') == cat) { redirect = redirects[j].getAttribute('to'); break; }
     qPreviewTemp += '<span dir="ltr"><a href="/wiki/'+cat.replace(reg1, '_')+'" title="'+cat+'"'+(missing ? ' class="new"' : '')+(redirect ? ' style="font-style:italic;"' : '')+'>'+cat.replace(/Catégorie:(.*)/, '$1')+'</a></span> • ';
    }
    qPreviewTemp = '<p class="catlinks"><a href="/wiki/Cat%C3%A9gorie:Accueil" title="Catégorie:Accueil">Catégorie'+(pages.length > 1 ? 's' : '')+' </a>: '+qPreviewTemp.substr(0, qPreviewTemp.length-5)+'</p>';
    document.getElementById('catlinks').innerHTML = qPreviewTemp;
    document.getElementById('catlinks').style.display = 'block';
    if(qPreviewEnd) btnQPreview.value = 'QPreview';
    qPreviewEnd = true;
   };
   qPreviewAjax2.send(null);
  }
  else { document.getElementById('catlinks').style.display = 'none'; if(qPreviewEnd) btnQPreview.value = 'QPreview'; qPreviewEnd = true; }
 }
 
 // Traitement des interwikis
 qPreviewIw = '';
 reg3 = new RegExp('\\|'); reg4 = new RegExp('(.*)]'); reg5 = new RegExp(';(.*)');
 regexIw = new RegExp('\\[\\[ *(\\w{2,12}) *: *(.*)\\]\\]', 'gi');
 result = qPreviewTextbox.match(regexIw);
 if(!result) { document.getElementById('p-lang').style.display = 'none'; return; }
 for(i=0;i<result.length;i++)
 {
  r1 = result[i].replace(regexIw, '$1');
  r2 = result[i].replace(regexIw, '$2').replace(reg1, '_');
  r3 = qPreviewLang.search(RegExp('\\|'+r1+'(?:;|\\|)', 'i'));
  if(r1 == qPreviewLanguage) { r3 = -1; qPreviewIw += '<li class="interwiki-'+r1+'"><b>Attention</b> : langue <b><u><i>'+r1+'</i></u></b> en interwiki</li>'; }
  if(r3 != -1) { r3 = qPreviewLang.substr(r3+1).replace(reg3,']'); r3 = reg4.exec(r3)[1]; qPreviewIw += '<li class="interwiki-'+r1+'"><a href="http://'+r1+'.wikipedia.org/wiki/'+r2+'">'+(r3.indexOf(';')!=-1 ? reg5.exec(r3)[1] : 'Langue \''+r1+'\'')+'</a></li>'; }
 }
 document.getElementById('p-lang').getElementsByTagName('ul')[0].innerHTML = qPreviewIw;
 if(qPreviewIw) document.getElementById('p-lang').style.display = 'block';
 else document.getElementById('p-lang').style.display = 'none';
}

/*
 * OptimizedNavigAdmin
 *
 * Liens utiles à l'administration
 *
 * Auteur : Dake
 * Contributeur : Tieno
 * Dernière révision : 12 novembre 2006
 */

function OptimizedNavigAdmin()
{
        var a = document.getElementById("p-Navigation");
        if (a)
        {
                b = a.getElementsByTagName("ul");
                if(b.length > 0)
                {
                        b[0].innerHTML = b[0].innerHTML
                                + '<br>'
                                + '<li><span id="n-admin" title="Wikipédia:Administrateur">'
                                + '<a href="/wiki/Wikipédia:Administrateur">Quêtes</a>'
                                + '</span></li>'
                                + '<li><span id="n-badmin" title="Wikipédia:Bulletin des administrateurs">'
                                + '<a href="/wiki/Wikipédia:Bulletin des administrateurs">Boites</a>'
                                + '</span></li>'
                                + '<li><span id="n-radmin" title="Catégorie:Racine">'
                                + '<a href="/wiki/Catégorie:Racine">Racine</a>'
                                + '</span></li>'
                                + '<li><span id="n-logs" title="Guild:Accueil">'
                                + '<a href="/wiki/Guild:Accueil">Accueil</a>'
                                + '</span></li>'
                                + '<li><span id="n-blockip" title="Special:Wantedpages">'
                                + '<a href="/wiki/Special:Wantedpages">Pages manquantes</a>'
                                + '</span></li>'
                                + '<li><span id="n-blockip" title="Special:Wantedcategories">'
                                + '<a href="/wiki/Special:Wantedcategories">Cat manquantes</a>'
                                + '</span></li>'
   
                }
        }
}
addOnloadHook(OptimizedNavigAdmin);

/* </source></pre> */