Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
/* Début du script des lauriers dans la barre d’outil
 *
 * Développement : [[Utilisateur:Antaya]]
 * Mise à jour : 27 mai 2008
 *
 */
 
//////////////////////ZONE PERSONNALISABLE//////////////////////
var signature = ' ~~' + '~~ }}';
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/3/35/Button_lauriers.png','Lauriers','== Lauriers ==\n' + '{{Récompense|1=Wikipedia laurier wp.png|taille=50px|2=Félicitation {{BASEPAGENAME}}!<br/>Je te remets ces lauriers pour l’ensemble de ton travail sur l’encyclopédie Wikipédia, mais plus particulièrement pour l’article ',signature,'???','mw-editbutton-lauriers');
 
/* Fin du script des lauriers dans la barre d’outil */
importScript('User:Dodoïste/aide.js');
//Bistro d'aujourd'hui
 
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 = year + 1900;
 
      return (day + " " + m[today.getMonth()] + " " + year);
}
 
 
function OptimizedNavig() 
{
  var a = document.getElementById("p-navigation");
  if (a) 
  {
    var b = a.getElementsByTagName("ul");
    if(b.length > 0)
    {
      b[0].innerHTML = b[0].innerHTML
      + '<br>'
      + '<li><span id="n-bistro" title="Wikipédia:Le Bistro">'
      + '<a href="/wiki/Wikipédia:Le_Bistro/' + TodayDate() + '">Le Bistro</a>'
      + '</span></li>'
      + '<li><span id="n-pas" title="Wikipédia:Pages à supprimer">'
      + '<a href="/wiki/Wikipédia:Pages à supprimer">Pages à supprimer</a>'
      + '</span></li>'
      + '<li><span id="n-ias" title="Wikipédia:Images à supprimer">'
      + '<a href="/wiki/Wikipédia:Images à supprimer">Images à supprimer</a>'
      + '</span></li>'
      + '<br>'
      + '<li><span id="n-radmin" title="Wikipédia:Requête aux administrateurs">'
      + '<a href="/wiki/Wikipédia:Requête aux administrateurs">Requêtes</a>'
      + '</span></li>'
      + '<li><span id="n-npages" title="Special:Newpages">'
      + '<a href="/wiki/Special:Newpages">Nouvelles pages</a>'
      + '</span></li>'
    }
  }
}
 
$(OptimizedNavig);
/**
 * Permet d'apposer des avertissements simples et calmes, pour les débutants ayant contribué maladroitement
 * Auteur : Stef48 et Dodoïste
 * Pour le [[Projet:Aide]]
 */
 
/* <nowiki> nowiki pour ne pas interprêter les caractères spéciaux de MediaWiki */
 
function buttonload () {
  if (mw.config.get('wgNamespaceNumber') == 3) { 
 
var Spam = '== Révocation de votre modification ==\n'
 + 'Bonjour, et merci pour votre tentative d’amélioration de l’encyclopédie libre [[Wikipédia]] ! Vous venez d’effectuer une modification sur un article, mais elle a dû être défaite. Ce n’est pas bien grave. {{;)}} !\n\n'
 + 'En effet, rajouter des liens externes n’est pas idéal puisqu’une des règles de Wikipédia est de ne pas être un annuaire de liens externes. Un excellent article peut contenir un seul lien (comme <span class="plainlinks">[https://fr.wikipedia.org/w/index.php?title=Thermo%C3%A9lectricit%C3%A9&oldid=30140570#Lien_externe Thermoélectricité]</span>) ou une douzaine (<span class="plainlinks">[https://fr.wikipedia.org/w/index.php?title=Assassinat_de_John_F._Kennedy&oldid=31170828#Liens_externes Assassinat de JFK]</span>).\n\n'
 + 'Ce qui compte est sa pertinence : <u>un lien externe doit contenir des informations encyclopédiques, dont on peut se servir pour améliorer l’article</u>. Vous pouvez trouver plus d’informations à ce propos sur [[Wikipédia:Liens externes]].\n\n'
 + 'Cependant, ne vous inquiétez pas ! Essayez de comprendre le fonctionnement de Wikipédia, continuez à l’améliorer pour le mieux et d’autres contributeurs vous aideront si vous le leur demandez. Si vous êtes perdu, il existe un [[Aide:Sommaire|sommaire de l’aide]].\n\n'
 + 'D’ailleurs, si vous avez des questions, n’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] {{=)}}. ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/cb/Pulsante_spam.png',
                'Revert de ta modif : spam',
                Spam,
                '',
                '',
                'mw-editbutton-aide');
 
var Syntaxe = '== Révocation de votre modification ==\n'
 + 'Bonjour, et bienvenue sur Wikipédia ! Vous venez d’effectuer une modification sur un article, mais elle a dû être défaite. Ce n’est pas bien grave : on est là pour s’entraider {{;)}}.\n\n'
 + 'En effet, votre modification n’était pas présentable en l’état. Généralement, il faut éviter le <b>gras</b> dans le corps d’un article, ne pas abuser des caractères en <i>italique</i>, des listes, des tableaux compliqués, éviter de sauter trop de lignes, respecter les conventions typographiques…\n\n'
 + 'Cela rendait l’article compliqué à la lecture. Je vous conseille de lire [[aide:syntaxe|la page d’aide sur la syntaxe]] : mais, ne cherchez pas à faire compliqué, écrivez votre texte simplement, d’autres contributeurs le mettront en forme.\n\n'
 + 'Cependant, ne vous inquiétez pas ! Essayez de comprendre le fonctionnement de Wikipédia, continuez à l’améliorer pour le mieux et d’autres contributeurs vous aideront si vous le leur demandez. Si vous êtes perdu, il existe un [[Aide:Sommaire|sommaire de l’aide]].\n\n'
 + 'D’ailleurs, si vous avez des questions, n’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] {{=)}}. ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c3/Button_syntaxe-stax.png',
                'Revert de ta modif : syntaxe',
                Syntaxe,
                '',
                '',
                'mw-editbutton-aide');
 
var Source = '== Révocation de votre modification ==\n'
 + 'Bonjour, et bienvenue sur Wikipédia ! Vous venez d’effectuer une modification sur un article, mais elle a dû être défaite. Ce n’est pas bien grave : on est là pour s’entraider {{;)}}.\n\n'
 + 'En effet, votre ajout était, selon moi, sujet à caution. Il n’est généralement pas nécessaire de citer ses sources lorsque l’information est logique ou évidente, mais dans des cas comme celui-ci c’est essentiel. La page [[Wikipédia:Citez vos sources]] résume assez bien tout ce qu’il faut savoir à ce sujet (quand, comment et quelles sources utiliser).\n\n'
 + 'Cependant, ne vous inquiétez pas ! Essayez de comprendre le fonctionnement de Wikipédia, continuez à l’améliorer pour le mieux et d’autres contributeurs vous aideront si vous le leur demandez. Si vous êtes perdu, il existe un [[Aide:Sommaire|sommaire de l’aide]].\n\n'
 + 'D’ailleurs, si vous avez des questions, n’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] {{=)}}. ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/c/c1/Button_source-srce.png',
                'Revert de ta modif : source et ref',
                Source,
                '',
                '',
                'mw-editbutton-aide');
 
var NPOV = '== Révocation de votre modification ==\n'
 + 'Bonjour, et bienvenue sur Wikipédia ! Vous venez d’effectuer une modification sur un article, mais elle a dû être défaite. Ce n’est pas bien grave : on est là pour s’entraider {{;)}}.\n\n'
 + 'En effet, votre modification ne respectait pas un point de vue neutre. Généralement, lors de l’ajout d’informations dans un article, il faut penser à respecter la neutralité qui est de rigueur sur une encyclopédie. Par exemple, il faut sourcer ses propos par des sources secondaires, des journaux, des livres, ou des sites internet fiables. Il faut attribuer les citations à leurs auteurs, et citer l’œuvre où elles sont parues.\n\n'
 + 'Je vous conseille de lire [[Wikipédia:Neutralité de point de vue|le principe fondateur sur la neutralité de point de vue]].\n\n'
 + 'Cependant, ne vous inquiétez pas ! Essayez de comprendre le fonctionnement de Wikipédia, continuez à l’améliorer pour le mieux et d’autres contributeurs vous aideront si vous le leur demandez. Si vous êtes perdu, il existe un [[Aide:Sommaire|sommaire de l’aide]].\n\n'
 + 'D’ailleurs, si vous avez des questions, n’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] {{=)}}. ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/6/6d/Button_npov.png',
                'Revert de ta modif : NPOV',
                NPOV,
                '',
                '',
                'mw-editbutton-aide');
 
var BVIP = '== Bienvenue ==\n'
 + '<table>\n'
 + ' <tr>\n'
 + '  <td>[[Image:Face-smile.svg|left|80px|Merci pour votre contribution]]</td>\n'
 + '  <td>\n'
 + 'Bonjour et bienvenue sur Wikipédia ! Je tenais à vous remercier pour votre apport à l’encyclopédie.\n\n'
 + 'Si vous le souhaitez vous pouvez <b>[[special:connexion|créer un compte]]</b>, et choisir ainsi vos préférences d’utilisateur et participer aux discussions et aux décisions de la communauté. C’est également plus pratique pour demander conseil à d’autres participants.\n\n'
 + 'N’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] si vous désirez une information ou une aide. Amicalement ~~~~\n'
 + '  </td>\n'
 + ' </tr>\n'
 + '</table>\n'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/8/8e/Button_BienvenueIP-BVIP.png',
                'Bienvenue IP',
                BVIP,
                '',
                '',
                'mw-editbutton-aide');
 
var BVCP = '== Violation de copyright ==\n'
 + 'Bonjour, et bienvenue sur Wikipédia ! Vous venez d’effectuer une modification sur un article, mais elle a dû être défaite. Ce n’est pas bien grave : on est là pour s’entraider {{;)}}.\n\n'
 + 'En effet, votre modification ne respectait pas les droits d’auteur, car elle provenait d’un site internet ou d’un livre non libre. La plupart des ressources disponibles ne sont, d’ailleurs, pas libres. Il faut souvent [[aide:republication|demander un accord]].\n\n'
 + 'Pour ne pas [[Wikipédia:Copyright|violer de droits d’auteur]], vous pouvez néanmoins vous aider de votre ressource, en la reformulant et en la synthétisant.\n'
 + 'Je vous conseille de lire [[Wikipédia:Copyright|cette page]] qui pourra vous aider à comprendre les droits d’auteur.\n\n'
 + 'Cependant, ne vous inquiétez pas ! Essayez de comprendre le fonctionnement de Wikipédia, continuez à l’améliorer pour le mieux et d’autres contributeurs vous aideront si vous le leur demandez. Si vous êtes perdu, il existe un [[Aide:Sommaire|sommaire de l’aide]].\n\n'
 + 'D’ailleurs, si vous avez des questions, n’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] {{=)}}. ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/5/58/Button_black_copyright.png',
                'Violation de Droits d’auteur',
                BVCP,
                '',
                '',
                'mw-editbutton-aide');
 
 
 var Portail = '{{Portail}}'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png',
                'portail info',
                Info,
                '',
                '',
                'mw-editbutton-aide');
 
 
 var Info = '|Informatique'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/a/ab/Button_Telephone_receiver.png',
                'portail info',
                Info,
                '',
                '',
                'mw-editbutton-aide');
 
 
 var SrceNA = '== Sources de ton article ==\n'
 + 'Merci pour ton amélioration de Wikipédia {{sourire}}\n\n'
 + 'Pourrais-tu indiquer les sources que tu as utilisées lors de la rédaction de ton article ? Ton article serait ainsi plus conforme aux usages wikipédiens de la [[Wikipédia:vérifiabilité|vérifiabilité]]. Cela indiquerait que le sujet existe bel et bien, et qu’il a des sources fiables sur lesquelles on peut se baser pour rédiger l’article.\n\n'
 + 'Quand une revue renommée, un auteur réputé, etc. donne un fait, on peut raisonnablement supposer que le fait est fiable, quelque soit l’identité du rédacteur (par nature invérifiable, ou peu s’en faut, sur Internet). Aussi, si les éléments dont vous avez connaissance ne sont rapportés nulle part (même une source papier, par exemple), les introduire dans l’article est mal vu, même si ils sont justes, compte tenu des risques sur la fiabilité (voir la légalité) de Wikipédia.\n\n'
 + 'Je t’encourage donc à ajouter tes sources sans tarder {{clin}} Bonne continuation ! ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/7/7d/Deletewarn2.png',
                'source nouveau article',
                SrceNA,
                '',
                '',
                'mw-editbutton-aide');
 
var groupArray = '#'+mw.config.get('wgUserGroups');
if (groupArray.indexOf("sysop") > 0) addCustomButton('https://upload.wikimedia.org/wikipedia/commons/e/e4/Bouton_Vandale3.png',
                'Blocage',
                '{{vandale bloqué|1|jour}}',
                '',
                '',
                'mw-editbutton-admin');
 
 if (mw.config.get('wgUserName') == 'Dodoïste') { 
 
var SupprTxt = '== Révocation de votre modification ==\n'
 + 'Bonjour {{subst:BASEPAGENAME}}, et bienvenue sur Wikipédia ! Vous venez d’effectuer une modification sur un article, mais elle a dû être défaite. Ce n’est pas bien grave : on est là pour s’entraider {{;)}}.\n\n'
 + 'En effet, votre modification contenait le blanchiment injustifié d’un passage d’un article.\n'
 + 'Si cette action était voulue, pourriez-vous m’en donner les raisons sur ma [[user talk:' + mw.config.get('wgUserName') + '|page de discussion]], sur celle de l’article, ou sur celle du projet correspondant (voir [[Projet:Accueil]]).\n'
 + 'À l’avenir, pensez à remplir la [[Aide:Toujours commenter vos modifications dans la boîte de résumé|barre de résumé]] pour aider les autres participants à comprendre vos intentions.\n\n'
 + 'Cependant, ne vous inquiétez pas ! Essayez de comprendre le fonctionnement de Wikipédia, continuez à l’améliorer pour le mieux et d’autres contributeurs vous aideront si vous le leur demandez. Si vous êtes perdu, il existe un [[Aide:Sommaire|sommaire de l’aide]].\n\n'
 + 'D’ailleurs, si vous avez des questions, n’hésitez pas à [[User talk:' + mw.config.get('wgUserName') + '|me contacter]] {{=)}}. ~~~~'
 
addCustomButton('https://upload.wikimedia.org/wikipedia/commons/5/50/Button_tidyman.png',
                'Revert de ta modif : Suppression de texte',
                SupprTxt,
                '',
                '',
                'mw-editbutton-dodo');
 
}
}
}
 
$(buttonload);
// Revert tools by Lorian
// French translation and fr.wikipedia modification by Fmaunier
function getElementsByClass(searchClass,node,tag) {
  // Function from http://www.dustindiaz.com/getelementsbyclass/
  var classElements = new Array();
  if ( node == null )
    node = document;
  if ( tag == null )
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}
 
// _GET code from NoGray JS Library http://www.nogray.com/new_site/
var _GET = new Array();
var _uri = location.href;
 
var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");
 
var _temp_get_arr_1 = new Array();
 
for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
  _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
  _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]);
}
 
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
 
function getMessage (where, user1, user2) {
  var message = prompt ('Quel message voulez-vous laisser ?', '');
  window.location = 'https://fr.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}
 
$(function (){
  if (location.href.match(/diff=/)) {
    // Get username of submitter
    var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
    var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[2].innerHTML;
    document.getElementById('contentSub').innerHTML = '(<a href="https://fr.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">Révoquer</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">Message</a>) (<a href="https://fr.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&vandalism=1&user1='+user1+'&user2='+user2+'">Vandalisme</a> / <a href="javascript:var message = getMessage(\'vandalism\', \''+user1+'\', \''+user2+'\');">Message</a>) (Avertissement : <a href="https://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=1">Test0</a> / <a href="https://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=2">Test1</a> / <a href="https://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=3">Bienvenue spammeur</a> / <a href="https://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=4">Bienvenue copyvio</a>)';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'Révocation des modifications de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] (retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']])';
    document.getElementById('editform').submit();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'Révocation des modifications de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] (retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]) ('+_GET['message']+')';
    document.getElementById('editform').submit();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } else if (location.href.match(/vandalism=1/)) {
    document.getElementById('wpSummary').value = 'Révocation du vandalisme de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] (retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']])';
    document.getElementById('editform').submit();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } else if (location.href.match(/vandalism=2/)) {
    document.getElementById('wpSummary').value = 'Révocation du vandalisme de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] (retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]) ('+_GET['message']+')';
    document.getElementById('editform').submit();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = 'Avertissement Vandalisme';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test0}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'Récidive Vandalisme';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test1}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'Avertissement Spam';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Bienvenue spammeur}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    var page_copyvio = prompt ('Quel est le nom de la page où a eu lieu le copyvio ? (Ne pas mettre les "[[]]")', '');
    document.getElementById('wpSummary').value = 'Avertissement Copyvio';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Copieur|' + page_copyvio + '}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
});
importScript('User:EDUCA33E/LiveRC.js');
//<nowiki>
/**
 * 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
 * [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
 */
 
// VARIABLES PERSONNALISABLES
 
// Suggestion delay in ms
var hotcat_suggestion_delay = 200;
 
// Taille de la liste déroulante (en items)
var hotcat_list_size = 10;
 
// Nombre de categories suggérées lors de la recherche
var hotcat_list_items = 50;
 
// Permet d'enregistrer automatiquement la modif sans repasser par la fenêtre d'édition
// var hotcat_autocommit = false;
 
// Permet d'afficher la liste de suggestion vers le bas
// var hotcat_list_down = false;
 
// FIN DE LA PERSONNALISATION DES VARIABLES
 
var hotcat_running = 0 ;
var hotcat_last_v = "" ;
var hotcat_exists_yes = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ;
var hotcat_exists_no = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ;
 
if( mw.config.get('wgNamespaceNumber')%2 == 0 && document.URL.indexOf("printable=yes")==-1) addOnloadHook ( hotcat ) ;
 
function hotcat () {
  if ( hotcat_check_action() ) return ; // Edited page, reloading anyway
 
  var catlinks = document.getElementById("catlinks");
 
  if (! catlinks) { // all except discussion
   // let's create a fake one
   var bodyC = document.getElementById("bodyContent");
   catlinks = document.createElement("div");
   catlinks.id = "catlinks"; 
   catlinks.className = "catlinks";
   catlinks = bodyC.appendChild(catlinks);
  }
 
  var catline = document.getElementById ('mw-normal-catlinks'); // Since MW 1.13alpha
  if( !catline ) {
   catline = catlinks.insertBefore(document.createElement("div"), catlinks.firstChild);
   catline.id = "mw-normal-catlinks";
  }
 
  if ( catline == null || typeof catline == 'undefined' ) return ;
 
  hotcat_modify_existing ( catline ) ;
  hotcat_append_add_span ( catline ) ;
}
 
var hotcat_edit_id_map=[];
 
function hotcatGetEditId(ob)
{
  var i;
  for(i=0;i<hotcat_edit_id_map.length;i++)
    if (hotcat_edit_id_map[i]===ob) return i;
  i=hotcat_edit_id_map.length;
  hotcat_edit_id_map.push(ob);
  return i;
}
 
function hotcat_append_add_span ( catline ) {
  var span_add = document.createElement ( "span" ) ;
  var span_sep = document.createTextNode ( " | " ) ;
  if ( catline.firstChild ) catline.appendChild ( span_sep ) ;
  else {
   var a = document.createElement('a');
   a.href = '/wiki/Catégorie:Accueil';
   a.title = 'Catégorie:Accueil';
   a.appendChild(document.createTextNode('Catégories'));
   catline.appendChild(a);
   catline.appendChild(document.createTextNode(' : '));
  }
  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 ) {
  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 i=hotcatGetEditId(span);
  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] ) ;
  }
}
 
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 ( mw.config.get('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:Gadget-HotCats.js|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();", hotcat_suggestion_delay ); } ;
 
  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.innerHTML ;
    // 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 = "" ;
    hotcat_modify_span ( span ) ;
  }
}
 
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 = mw.config.get('wgServer') + "/" + mw.config.get('wgScriptPath') + "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent( v ) + "&aplimit=" + encodeURIComponent( hotcat_list_items );
    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 = hotcat_list_size * 20 ;
  if (titles.length < hotcat_list_size) {
    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 suggestion = first_title;
 
  text.value = suggestion  ;
  if (text.createTextRange) {
    // IE
    var ra = text.createTextRange();
    ra.moveStart("character", hotcat_last_v.length);
    ra.moveEnd("character", suggestion.length);
    ra.select();
  } else if( is_khtml ) {
    text.setSelectionRange( hotcat_last_v.length, suggestion.length );
  } else {
    text.selectionStart = hotcat_last_v.length ;
    text.selectionEnd = suggestion.length ;
  }
}
//</nowiki>