MediaWiki:Common.js : Différence entre versions

De The Crowdsourced Resource-Based Economy Knowledgebase
Aller à : Navigation, rechercher
(Annulation des modifications 88120876 de Arkanosis (d) + commentaire dans le code)
m (1 version)
 
(Une révision intermédiaire par un utilisateur est masquée)
Ligne 1 : Ligne 1 :
 
/**
 
/**
  * IMPORTANT: There is a re-writing/jquerization of this page in [[Projet:JavaScript/Refonte Common.js avec jQuery]], but has not been tested.
+
  * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
  * Il y a une ré-écriture de cette page en utilisant jQuery sur [[Projet:JavaScript/Refonte Common.js avec jQuery]], mais n'a pas été testé.
+
  * loaded for all users on every wiki page. If possible create a gadget that is
 +
* enabled by default instead of adding it here (since gadgets are fully
 +
* optimized ResourceLoader modules with possibility to add dependencies etc.)
 +
*
 +
* Since Common.js isn't a gadget, there is no place to declare its
 +
* dependencies, so we have to lazy load them with mw.loader.using on demand and
 +
* then execute the rest in the callback. In most cases these dependencies will
 +
* be loaded (or loading) already and the callback will not be delayed. In case a
 +
* dependency hasn't arrived yet it'll make sure those are loaded before this.
 
  */
 
  */
 +
/*global mw, $, importStylesheet, importScript */
 +
/*jshint curly:false eqnull:true, strict:false, browser:true, */
 +
mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () {
 +
/* Begin of mw.loader.using callback */
  
 
/**
 
/**
  * N'importe quel JavaScript ici sera chargé pour n'importe quel utilisateur et pour chaque page accédée.
+
  * Main Page layout fixes
 
  *
 
  *
  * ATTENTION : Avant de modifier cette page, veuillez tester vos changements avec votre propre
+
  * Description: Adds an additional link to the complete list of languages available.
* vector.js. Une erreur sur cette page peut faire bugger le site entier (et gêner l'ensemble des
+
  * Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
  * visiteurs), même plusieurs heures après la modification !
+
*
+
* Prière de ranger les nouvelles fonctions dans les sections adaptées :
+
* - Fonctions JavaScript
+
* - Fonctions spécifiques pour MediaWiki
+
* - Applications spécifiques à la fenêtre d'édition
+
* - Applications qui peuvent être utilisées sur toute page
+
* - Applications spécifiques à un espace de nom ou une page
+
*
+
* <nowiki> /!\ Ne pas retirer cette balise
+
 
  */
 
  */
 
+
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
 
+
    $( document ).ready( function () {
 
+
        mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
/*************************************************************/
+
            'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
/* Fonctions JavaScript : pallient les limites de JavaScript */
+
    } );
/* Surveiller : http://www.ecmascript.org/                   */
+
/*************************************************************/
+
 
+
/**
+
* insertAfter : insérer un élément dans une page
+
*/
+
function insertAfter(parent, node, referenceNode) {
+
  parent.insertBefore(node, referenceNode.nextSibling);
+
 
}
 
}
  
 
/**
 
/**
  * getElementsByClass : rechercher les éléments de la page dont le paramètre "class" est celui recherché
+
  * Redirect User:Name/skin.js and skin.css to the current skin's pages
 +
* (unless the 'skin' page really exists)
 +
* @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
 +
* @rev: 2
 
  */
 
  */
function getElementsByClass(searchClass, node, tag) {
+
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
  if (node == null) node = document;
+
    var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
  if (tag == null) tag = '*';
+
    /* Make sure there was a part before and after the slash
  return getElementsByClassName(node, tag, searchClass);
+
      and that the latter is 'skin.js' or 'skin.css' */
}
+
     if ( titleParts.length == 2 ) {
 
+
        var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
/**
+
         if ( titleParts.slice( -1 ) == 'skin.js' ) {
* Diverses fonctions manipulant les classes
+
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
* Utilise des expressions régulières et un cache pour de meilleures perfs
+
        } else if ( titleParts.slice( -1 ) == 'skin.css' ) {
* isClass et whichClass depuis http://fr.wikibooks.org/w/index.php?title=MediaWiki:Common.js&oldid=140211
+
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
* hasClass, addClass, removeClass et eregReplace depuis http://drupal.org.in/doc/misc/drupal.js.source.html
+
        }
* surveiller l'implémentation de .classList http://www.w3.org/TR/2008/WD-html5-diff-20080122/#htmlelement-extensions
+
*/
+
function isClass(element, classe) {
+
     return hasClass(element, classe);
+
}
+
 
+
function whichClass(element, classes) {
+
    var s=" "+element.className+" ";
+
    for(var i=0;i<classes.length;i++)
+
         if (s.indexOf(" "+classes[i]+" ")>=0) return i;
+
    return -1;
+
}
+
 
+
function hasClass(node, className) {
+
    var haystack = node.className;
+
    if(!haystack) return false;
+
    if (className === haystack) {
+
        return true;
+
 
     }
 
     }
    return (" " + haystack + " ").indexOf(" " + className + " ") > -1;
 
 
}
 
}
 
function addClass(node, className) {
 
    if (hasClass(node, className)) {
 
        return false;
 
    }
 
    var cache = node.className;
 
    if (cache) {
 
        node.className = cache + ' ' + className;
 
    } else {
 
        node.className = className;
 
    }
 
    return true;
 
}
 
 
function removeClass(node, className) {
 
  if (!hasClass(node, className)) {
 
    return false;
 
  }
 
  node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
 
  return true;
 
}
 
 
function eregReplace(search, replace, subject) {
 
    return subject.replace(new RegExp(search,'g'), replace);
 
}
 
 
  
 
/**
 
/**
  * Récupère la valeur du cookie
+
  * Map addPortletLink to mw.util
 +
*
 +
* @deprecated: Use mw.util.addPortletLink instead.
 
  */
 
  */
function getCookieVal(name) {
+
window.addPortletLink = function () {
  var cookiePos = document.cookie.indexOf(name + "=");
+
     return mw.util.addPortletLink.apply( mw.util, arguments );
  var cookieValue = false;
+
};
  if (cookiePos > -1) {
+
    cookiePos += name.length + 1;
+
    var endPos = document.cookie.indexOf(";", cookiePos);
+
    if (endPos > -1)
+
      cookieValue = document.cookie.substring(cookiePos, endPos);
+
    else
+
      cookieValue = document.cookie.substring(cookiePos);
+
  }
+
  return cookieValue;
+
}
+
 
+
// Récupère proprement le contenu textuel d'un noeud et de ses noeuds descendants
+
// Copyright Harmen Christophe, http://openweb.eu.org/articles/validation_avancee, CC
+
function getTextContent(oNode) {
+
  if(!oNode) return null;
+
  if (typeof(oNode.textContent)!="undefined") {return oNode.textContent;}
+
  switch (oNode.nodeType) {
+
     case 3: // TEXT_NODE
+
    case 4: // CDATA_SECTION_NODE
+
      return oNode.nodeValue;
+
      break;
+
    case 7: // PROCESSING_INSTRUCTION_NODE
+
    case 8: // COMMENT_NODE
+
      if (getTextContent.caller!=getTextContent) {
+
        return oNode.nodeValue;
+
      }
+
      break;
+
    case 9: // DOCUMENT_NODE
+
    case 10: // DOCUMENT_TYPE_NODE
+
    case 12: // NOTATION_NODE
+
      return null;
+
      break;
+
  }
+
  var _textContent = "";
+
  oNode = oNode.firstChild;
+
  while (oNode) {
+
    _textContent += getTextContent(oNode);
+
    oNode = oNode.nextSibling;
+
  }
+
  return _textContent;
+
}
+
 
+
// Array.indexOf : recherche un élément dans un tableau
+
 
+
if (!Array.prototype.indexOf) {
+
Array.prototype.indexOf = function(obj) {
+
for (var i=0; i<this.length; i++) {
+
if (this[i] == obj){
+
return i;
+
}
+
}
+
return -1;
+
}
+
}
+
 
+
if(!String.prototype.HTMLize){
+
  String.prototype.HTMLize = function() {
+
    var chars = new Array('&','<','>','"');
+
    var entities = new Array('amp','lt','gt','quot');
+
    var string = this;
+
    for (var i=0; i<chars.length; i++) {
+
      var regex = new RegExp(chars[i], "g");
+
      string = string.replace(regex, '&' + entities[i] + ';');
+
    }
+
    return string;
+
  }
+
}
+
 
+
 
+
/**********************************************************************************************************/
+
/* Fonctions générales MediaWiki (pallient les limitations du logiciel)                                  */
+
/* Surveiller : http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/wikibits.js?view=log  */
+
/**********************************************************************************************************/
+
 
+
/*
+
* Fonction générales de lancement de fonctions ou de script
+
* DÉPRÉCIÉ : utiliser addOnloadHook simplement
+
*/
+
function addLoadEvent(func) {
+
  addOnloadHook(func);
+
}
+
  
 
/**
 
/**
  * Insérer un JavaScript d'une page particulière, idée de Mickachu
+
  * Extract a URL parameter from the current URL
  * DÉPRÉCIÉ : utiliser importScript qui fait partie du logiciel
+
  *
 +
* @deprecated: Use mw.util.getParamValue with proper escaping
 
  */
 
  */
function loadJs(page) {
+
window.getURLParamValue = function () {
  importScript(page);
+
    return mw.util.getParamValue.apply( mw.util, arguments );
}
+
};
  
/**
+
/**  
  * Projet JavaScript
+
  * Test if an element has a certain class
 +
*
 +
* @deprecated:  Use $(element).hasClass() instead.
 
  */
 
  */
function obtenir(name) {
+
window.hasClass = function ( element, className ) {
  importScript('MediaWiki:Gadget-' + name + '.js');
+
    return $( element ).hasClass( className );
}
+
};
  
 
/**
 
/**
  * Transformer les pages du Bistro, du BA et les pages spécifiées en page de discussion
+
  * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
 +
* @rev 5
 
  */
 
  */
function TransformeEnDiscussion() {
+
// CSS
  if(  (wgPageName.search('Wikipédia:Le_Bistro') != -1)
+
var extraCSS = mw.util.getParamValue( 'withCSS' );
    || (wgPageName.search('Wikipédia:Bulletin_des_administrateurs') != -1)
+
if ( extraCSS ) {
    || document.getElementById('transformeEnPageDeDiscussion')) {
+
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
    removeClass(document.body, 'ns-subject');
+
importStylesheet( extraCSS );
    addClass(document.body, 'ns-talk');
+
} else {
  }
+
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
 +
}
 
}
 
}
addOnloadHook(TransformeEnDiscussion);
 
  
/**
+
// JS
* Transformer certaines pages en pseudo-article
+
var extraJS = mw.util.getParamValue( 'withJS' );
* c'est raisonnable ? --Tavernier
+
if ( extraJS ) {
*/
+
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
function TransformeEnArticle() {
+
importScript( extraJS );
  var transformeEnA = document.getElementById("transformeEnArticle");
+
} else {
  if(transformeEnA) document.body.className = "ns-0";
+
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
 +
}
 
}
 
}
addOnloadHook(TransformeEnArticle);
 
  
 
/**
 
/**
  * Ajouter un bouton à la fin de la barre d'outils
+
  * Import more specific scripts if necessary
 
  */
 
  */
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {
+
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
  mwCustomEditButtons[mwCustomEditButtons.length] =
+
     /* scripts specific to editing pages */
     {"imageId": imageId,
+
    importScript( 'MediaWiki:Common.js/edit.js' );
    "imageFile": imageFile,
+
} else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {
    "speedTip": speedTip,
+
    /* watchlist scripts */
    "tagOpen": tagOpen,
+
    importScript( 'MediaWiki:Common.js/watchlist.js' );
    "tagClose": tagClose,
+
    "sampleText": sampleText};
+
 
}
 
}
 
+
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
 
+
    /* file description page scripts */
 
+
    importScript( 'MediaWiki:Common.js/file.js' );
/****************************************/
+
/* Applications pour l'ensemble du site */
+
/****************************************/
+
 
+
/**
+
* Tout ce qui concerne la page d'édition
+
* Voir MediaWiki:Common.js/edit.js pour ces fonctions
+
*/
+
if( mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit' ) {
+
  importScript( 'MediaWiki:Common.js/edit.js' );
+
 
}
 
}
  
 
/**
 
/**
  * Réécriture des titres
+
  * Load scripts specific to Internet Explorer
*
+
* Fonction utilisée par [[Modèle:Titre incorrect]]
+
*
+
* La fonction cherche un bandeau de la forme
+
* <div id="RealTitleBanner">
+
*  <span id="RealTitle">titre</span>
+
* </div>
+
*
+
* Un élément comportant id="DisableRealTitle" désactive la fonction
+
 
  */
 
  */
function rewritePageH1() {
+
if ( $.client.profile().name === 'msie' ) {
  var realTitleBanner = document.getElementById('RealTitleBanner');
+
    importScript( 'MediaWiki:Common.js/IEFixes.js' );
  if (realTitleBanner) {
+
    if (!document.getElementById('DisableRealTitle')) {
+
      var realTitle = document.getElementById('RealTitle');
+
      var h1 = document.getElementById('firstHeading');
+
      if(!h1) h1 = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
+
      var realH1 = getTextContent(h1);
+
      if (realTitle && h1) {
+
        var titleText = realTitle.innerHTML;
+
        if (titleText == '') h1.style.display = 'none';
+
        else h1.innerHTML = titleText;
+
        realTitleBanner.style.display = 'none';
+
        var avert = document.createElement('p')
+
        avert.style.fontSize = '80%';
+
        avert.innerHTML = 'Titre à utiliser pour créer un lien interne : <b>'+realH1.HTMLize()+'</b>';
+
        insertAfter(h1.parentNode,avert,h1);
+
      }
+
    }
+
  }
+
 
}
 
}
addOnloadHook(rewritePageH1);
 
  
 
/**
 
/**
  * Icônes de titre
+
  * Fix for Windows XP Unicode font rendering
*
+
* Cherche les icônes de titre (class="icone_de_titre") et les
+
* déplace à droite du titre de la page.
+
* Doit être exécuté après une éventuelle correction de titre.
+
 
  */
 
  */
function IconesDeTitre() {
+
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) {
  var h1 = document.getElementById('firstHeading');
+
    mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' +
  if(!h1) h1 = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
+
                '.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' );
  if(!h1) return;
+
  var icones = getElementsByClass( "icone_de_titre", document, "div" );
+
  for( var j = icones.length; j > 0; --j ){
+
    icones[j-1].style.display = "block"; /* annule display:none par défaut */
+
    if(( skin == "modern" )||( skin == "vector" )){
+
      icones[j-1].style.marginTop = "0em";
+
    }
+
    h1.parentNode.insertBefore(icones[j-1], h1); /* déplacement de l'élément */
+
  }
+
 
}
 
}
addOnloadHook(IconesDeTitre);
 
  
 
/**
 
/**
  * Déplacement de coordonnées qui apparaissent en haut de la page
+
  * WikiMiniAtlas
*/
+
function moveCoord() {
+
  var h1 = document.getElementById('firstHeading');
+
  if(!h1) h1 = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
+
  var coord = document.getElementById('coordinates');
+
  if ( !coord || !h1 ) return;
+
  coord.id = "coordinates-title";
+
  h1.parentNode.insertBefore(coord, h1); /* déplacement de l'élément */
+
}
+
addOnloadHook(moveCoord);
+
 
+
// Verwendung von OpenStreetMap in Wikipedia.
+
// (c) 2008 by Magnus Manske
+
// Released under GPL
+
// Modifié pour marcher après moveCoord() ci-dessus
+
 
+
if(typeof(MoveResizeAbsolute_AddMoveArea)!="function") obtenir('MoveResizeAbsolute');
+
 
+
function openStreetMap_Init () {
+
  var c = document.getElementById ( 'coordinates-title' ) ;
+
  if ( !c ) return ;
+
 
+
  var a = c.getElementsByTagName ( 'a' ) ;
+
  var geohack = false;
+
  for ( var i = 0 ; i < a.length ; i++ ) {
+
    var h = a[i].href ;
+
    if ( !h.match(/geohack/) ) continue ;
+
    geohack = true ;
+
    break ;
+
  }
+
  if ( !geohack ) return ;
+
 
+
  var na = document.createElement ( 'a' ) ;
+
  na.href = 'javascript:openStreetMap_Toggle();' ;
+
  na.title = 'Afficher/Masquer la carte' ;
+
  na.appendChild ( document.createTextNode ( 'carte' ) ) ;
+
  c.appendChild ( document.createTextNode ( ' (' ) ) ;
+
  c.appendChild ( na ) ;
+
  c.appendChild ( document.createTextNode ( ')  ' ) ) ;
+
}
+
 
+
function openStreetMap_Toggle () {
+
  var c = document.getElementById ( 'coordinates-title' ) ;
+
  if ( !c) return ;
+
  var osm = document.getElementById ( 'OpenStreetMap' ) ;
+
 
+
  if (osm) {
+
    if ( osm.style.display == 'none' ) {
+
      osm.style.display = 'block' ;
+
    } else {
+
      osm.style.display = 'none' ;
+
    }
+
    return;
+
  }
+
 
+
  var found_link = false ;
+
  var a = c.getElementsByTagName ( 'a' ) ;
+
  var h;
+
  for ( var i = 0 ; i < a.length ; i++ ) {
+
    h = a[i].href ;
+
    if ( !h.match(/geohack/) ) continue ;
+
    found_link = true ;
+
    break ;
+
  }
+
  if ( !found_link ) return ; // No geohack link found
+
 
+
  h = h.split('params=')[1] ;
+
 
+
  var LargeurEcran = MoveResizeAbsolute_GetScreenWidth();
+
  var HauteurEcran = MoveResizeAbsolute_GetScreenHeight();
+
 
+
  var OSMDiv = document.createElement('div');
+
  OSMDiv.id = 'OpenStreetMap' ;
+
  OSMDiv.style.position = "absolute";
+
  OSMDiv.style.zIndex = 5000;
+
  OSMDiv.style.top = (HauteurEcran*10/100) + "px";
+
  OSMDiv.style.left = (LargeurEcran*15/100) + "px";
+
  OSMDiv.style.width = "70%";
+
  OSMDiv.style.height = (HauteurEcran*80/100) + "px";
+
  OSMDiv.style.border = "2px solid black";
+
  OSMDiv.style.backgroundColor = "white";
+
  OSMDiv.style.overflow = "hidden";
+
 
+
  var MoveArea = document.createElement('div');
+
  MoveArea.style.position = "relative";
+
  MoveArea.style.top = "0";
+
  MoveArea.style.width = "100%";
+
  MoveArea.style.height = "50px";
+
  MoveArea.title = "Cliquer et glisser pour déplacer la carte";
+
 
+
  var CloseLink = document.createElement('a');
+
  CloseLink.setAttribute("style", "float:right;margin:10px;");
+
  CloseLink.innerHTML = "Masquer";
+
  CloseLink.title = "Cliquer pour masquer la carte";
+
  CloseLink.href = "javascript:openStreetMap_Toggle();";
+
  MoveArea.appendChild(CloseLink);
+
 
+
  var iFrame = document.createElement ( 'iframe' ) ;
+
  var url = '//toolserver.org/~kolossos/openlayers/kml-on-ol.php?'
+
          + 'lang=' + mw.config.get('wgUserLanguage')
+
          + '&params=' + h
+
          + '&title=' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) )
+
          + ( window.location.protocol == 'https:' ? '&secure=1' : '' ) ;
+
  iFrame.style.width = '100%' ;
+
  iFrame.style.height = ((HauteurEcran*80/100)-100) + 'px' ;
+
  iFrame.style.clear = 'both' ;
+
  iFrame.src = url ;
+
 
+
  var ResizeArea = document.createElement('div');
+
  ResizeArea.style.position = "relative";
+
  ResizeArea.style.top = "0";
+
  ResizeArea.style.width = "100%";
+
  ResizeArea.style.height = "50px";
+
  ResizeArea.title = "Cliquer et glisser pour redimensionner la carte";
+
 
+
  OSMDiv.appendChild(MoveArea);
+
  OSMDiv.appendChild(iFrame);
+
  OSMDiv.appendChild(ResizeArea);
+
 
+
  document.body.appendChild ( OSMDiv ) ;
+
 
+
  var ElementsToMove = new Array(OSMDiv);
+
  var ElementsToResize = new Array(OSMDiv, iFrame);
+
  var ElementsMinWidth = new Array(150, 150);
+
  var ElementsMinHeights = new Array(200, 100);
+
 
+
  MoveResizeAbsolute_AddMoveArea(MoveArea, ElementsToMove);
+
  MoveResizeAbsolute_AddResizeArea(ResizeArea, ElementsToResize, ElementsMinWidth, ElementsMinHeights);
+
}
+
 
+
addOnloadHook(openStreetMap_Init);
+
 
+
/**
+
* Ajout d'un sous-titre
+
*
+
* Fonction utilisée par [[Modèle:Sous-titre]]
+
*
+
* La fonction cherche un élément de la forme
+
* <span id="sous_titre_h1">Sous-titre</span>
+
 
  *
 
  *
  * Doit être exécutée après les fonctions d'icônes de titre
+
  * Description: WikiMiniAtlas is a popup click and drag world map.
 +
*              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
 +
*              The script itself is located on meta because it is used by many projects.
 +
*              See [[Meta:WikiMiniAtlas]] for more information.
 +
* Maintainers: [[User:Dschwen]]
 
  */
 
  */
 
+
( function () {
function sousTitreH1() {
+
    var require_wikiminiatlas = false;
  var span= document.getElementById('sous_titre_h1');
+
    var coord_filter = /geohack/;
  var title=document.getElementById('firstHeading');
+
    $( document ).ready( function() {
  if(!title) title = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
+
        $( 'a.external.text' ).each( function( key, link ) {
  if (span && title) {
+
            if ( link.href && coord_filter.exec( link.href ) ) {
      var subtitle=span.cloneNode(true);
+
                require_wikiminiatlas = true;
      title.appendChild(document.createTextNode(' '));
+
                // break from loop
      title.appendChild(subtitle);
+
                return false;
      span.parentNode.removeChild(span);
+
            }
  }
+
        } );
}
+
        if ( $( 'div.kmldata' ).length ) {
addOnloadHook(sousTitreH1);
+
            require_wikiminiatlas = true;
 +
        }
 +
        if ( require_wikiminiatlas ) {
 +
            mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
 +
        }
 +
    } );
 +
} )();
  
 
/**
 
/**
  * Déplacement des [modifier]
+
  * Interwiki links to featured articles ***************************************
 
  *
 
  *
  * Correction des titres qui s'affichent mal en raison de limitations dues à MediaWiki.
+
  * Description: Highlights interwiki links to featured articles (or
* Ce script devrait pouvoir être supprimé lorsque le [[bugzilla:11555]] sera résolu (comportement équivalent)
+
  *             equivalents) by changing the bullet before the interwiki link
  *
+
  *             into a star.
* Copyright 2006, Marc Mongenet. Licence GPL et GFDL.
+
  * Maintainers: [[User:R. Koot]]
*
+
* The function looks for <span class="editsection">, and move them
+
* at the end of their parent and display them inline in small font.
+
* var oldEditsectionLinks=true disables the function.
+
  *
+
* /!\ Il semblerait naturel de déclencher ce code à l'évènement domcontentloaded
+
* plutôt que load (avec $(document).ready(), par exemple), pour réduire la gêne
+
  * résultant des modifications du DOM (sursauts…). Mais le comportement est assez
+
* aléatoire car le Common.js est chargé /en début/ de page.
+
 
  */
 
  */
function setModifySectionStyle(element) {
+
function LinkFA() {
 +
    if ( document.getElementById( 'p-lang' ) ) {
 +
        var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
  
    if (typeof oldEditsectionLinks !== 'undefined' && oldEditsectionLinks) {
+
         for ( var i = 0; i < InterwikiLinks.length; i++ ) {
        return;
+
             if ( document.getElementById( InterwikiLinks[i].className + '-fa' ) ) {
    }
+
                 InterwikiLinks[i].className += ' FA';
 
+
                 InterwikiLinks[i].title = 'This is a featured article in another language.';
    var racine = element ? element : document;
+
            } else if ( document.getElementById( InterwikiLinks[i].className + '-ga' ) ) {
 
+
                InterwikiLinks[i].className += ' GA';
    try {
+
                InterwikiLinks[i].title = 'This is a good article in another language.';
         for (var sections = ["h1", "h2", "h3", "h4", "h5", "h6"], i = 0; i < 6; i++) {
+
             var list = racine.getElementsByTagName(sections[i]);
+
            for (var j = 0, l = list.length; j < l; j++) {
+
                 var parent = list[j];
+
                 var span = parent.firstChild;
+
                if (span.className === "editsection") {
+
                    addClass(parent, "modifiedSectionTitle");
+
                    parent.appendChild(span);
+
                }
+
 
             }
 
             }
 
         }
 
         }
 
     }
 
     }
    catch (e) { }
 
 
}
 
}
  
addOnloadHook(setModifySectionStyle);
+
$( LinkFA );
 
+
  
 
/**
 
/**
  * Boîtes déroulantes
+
  * Collapsible tables *********************************************************
 
  *
 
  *
  * Pour [[Modèle:Méta palette de navigation]]
+
  * Description: Allows tables to be collapsed, showing only the header. See
 +
*              [[Wikipedia:NavFrame]].
 +
* Maintainers: [[User:R. Koot]]
 
  */
 
  */
  
var Palette_Enrouler = '[masquer]';
+
var autoCollapse = 2;
var Palette_Derouler  = '[afficher]';
+
var collapseCaption = 'hide';
 +
var expandCaption = 'show';
  
var Palette_max = 1;
+
window.collapseTable = function ( tableIndex ) {
var Palette_index = -1;
+
    var Button = document.getElementById( 'collapseButton' + tableIndex );
 +
    var Table = document.getElementById( 'collapsibleTable' + tableIndex );
  
function Palette_toggle(indexPalette){
+
    if ( !Table || !Button ) {
  var Button = document.getElementById( "collapseButton" + indexPalette);
+
         return false;
  var Table = document.getElementById( "collapsibleTable" + indexPalette);
+
  if (!Table || !Button) return false;
+
 
+
  var Rows = Table.rows;
+
  var RowDisplay = "none";
+
  if (Button.firstChild.data == Palette_Derouler) {
+
    Button.firstChild.data = Palette_Enrouler;
+
    RowDisplay = Rows[0].style.display;
+
  } else {
+
    Button.firstChild.data = Palette_Derouler;
+
  }
+
  for (var i = 1; i < Rows.length; i++) {
+
    Rows[i].style.display = RowDisplay
+
  }
+
}
+
 
+
function Palette(Element){
+
  if(!Element) Element = document;
+
  var TableIndex = 0;
+
  var TableIndexes = new Array();
+
  var Tables = Element.getElementsByTagName( "table" );
+
  for ( var i = 0; i < Tables.length; i++ ) {
+
    if ( hasClass( Tables[i], "collapsible" ) ) {
+
      var Table = Tables[i];
+
      var Header = Table.getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
+
      /* only add button and increment count if there is a header row to work with */
+
      if (Header) {
+
         TableIndex++
+
        Palette_index++;
+
        TableIndexes[Palette_index] = Table;
+
        Table.setAttribute( "id", "collapsibleTable" + Palette_index );
+
        var Button    = document.createElement( "span" );
+
        var ButtonLink = document.createElement( "a" );
+
        var ButtonText = document.createTextNode( Palette_Enrouler );
+
        Button.className = "navboxToggle";
+
        ButtonLink.setAttribute( "id", "collapseButton" + Palette_index );
+
        ButtonLink.setAttribute( "href", "javascript:;" );
+
        addHandler( ButtonLink,  "click", new Function( "evt", "Palette_toggle(" + Palette_index + " ); return killEvt( evt );") );
+
        ButtonLink.appendChild( ButtonText );
+
        Button.appendChild( document.createTextNode("\u00a0"));  //ajout d'un espace insécable pour décoller ce bouton du texte de la celulle
+
        Button.appendChild( ButtonLink );
+
        Header.insertBefore( Button, Header.childNodes[0] );
+
      }
+
 
     }
 
     }
  }
 
  for(var index in TableIndexes){
 
    var Table = TableIndexes[index];
 
    if(hasClass(Table,"collapsed")||(TableIndex>Palette_max && hasClass(Table,"autocollapse")))
 
    Palette_toggle(index);
 
  }
 
}
 
addOnloadHook(Palette);
 
  
 +
    var Rows = Table.rows;
 +
    var i;
  
/**
+
    if ( Button.firstChild.data === collapseCaption ) {
* Pour [[Modèle:Boîte déroulante]]
+
        for ( i = 1; i < Rows.length; i++ ) {
*/
+
             Rows[i].style.display = 'none';
 
+
        }
var BoiteDeroulante_Enrouler = '[masquer]';
+
        Button.firstChild.data = expandCaption;
var BoiteDeroulante_Derouler  = '[afficher]';
+
var BoiteDeroulante_max = 0;
+
var BoiteDeroulante_index = -1;
+
 
+
function BoiteDeroulante_toggle(indexBoiteDeroulante){
+
      var NavFrame = document.getElementById("NavFrame" + indexBoiteDeroulante);
+
      var NavToggle = document.getElementById("NavToggle" + indexBoiteDeroulante);
+
      var CaptionContainer = document.getElementById("NavCaption" + indexBoiteDeroulante);
+
      if (!NavFrame || !NavToggle || !CaptionContainer) return;
+
      var caption = new Array();
+
      var CaptionSpans = CaptionContainer.getElementsByTagName('span');
+
      caption[0] = CaptionSpans[0].innerHTML;
+
      caption[1] = CaptionSpans[1].innerHTML;
+
 
+
      var Contents = NavFrame.getElementsByTagName('div');
+
      if (NavToggle.innerHTML == caption[1]) {
+
            NavToggle.innerHTML = caption[0];
+
            for(var a=0,m=Contents.length;a<m;a++){
+
                  if(hasClass(Contents[a], "NavContent")){
+
                        Contents[a].style.display = 'none';
+
                        return;
+
                  }
+
            }
+
      }else{
+
            NavToggle.innerHTML = caption[1];
+
            for(var a=0,m=Contents.length;a<m;a++){
+
                  if(hasClass(Contents[a], "NavContent")){
+
                        Contents[a].style.display = 'block';
+
                        return;
+
                  }
+
            }
+
      }
+
}
+
 
+
function BoiteDeroulante(Element){
+
      if(!Element) Element = document;
+
      var NavFrameCount = -1;
+
      var NavFrames = Element.getElementsByTagName("div");
+
      for(var i=0,l=NavFrames.length;i<l;i++){
+
             if(hasClass(NavFrames[i], "NavFrame")){
+
                  var NavFrame = NavFrames[i];
+
                  NavFrameCount++;
+
                  BoiteDeroulante_index++;
+
 
+
                  if (NavFrame.title && NavFrame.title.indexOf("/")!=-1) {
+
                        var Enrouler = NavFrame.title.HTMLize().split("/")[1];
+
                        var Derouler = NavFrame.title.HTMLize().split("/")[0];
+
                  }else{
+
                        var Enrouler = BoiteDeroulante_Enrouler;
+
                        var Derouler = BoiteDeroulante_Derouler;
+
                  }
+
                  NavFrame.title='';
+
                  var CaptionContainer = document.createElement('span');
+
                  CaptionContainer.id = 'NavCaption' + BoiteDeroulante_index;
+
                  CaptionContainer.style.display = "none";
+
                  CaptionContainer.innerHTML = '<span>' + Derouler + '</span><span>' + Enrouler + '</span>';
+
                  NavFrame.appendChild(CaptionContainer);
+
 
+
                  var NavToggle = document.createElement("a");
+
                  NavToggle.className = 'NavToggle';
+
                  NavToggle.id = 'NavToggle' + BoiteDeroulante_index;
+
                  NavToggle.href = 'javascript:BoiteDeroulante_toggle(' + BoiteDeroulante_index + ');';
+
                  var NavToggleText = document.createTextNode(Enrouler);
+
                  NavToggle.appendChild(NavToggleText);
+
 
+
                  NavFrame.insertBefore( NavToggle, NavFrame.firstChild );
+
                  NavFrame.id = 'NavFrame' + BoiteDeroulante_index;
+
                  if (BoiteDeroulante_max <= NavFrameCount) {
+
                        BoiteDeroulante_toggle(BoiteDeroulante_index);
+
                  }
+
            }
+
      }
+
 
+
}
+
addOnloadHook(BoiteDeroulante);
+
 
+
/**
+
* Utilisation du modèle Modèle:Images
+
*/
+
function toggleImage(group, remindex, shwindex) {
+
    document.getElementById('ImageGroupsGr' + group + 'Im' + remindex).style.display = 'none';
+
    document.getElementById('ImageGroupsGr' + group + 'Im' + shwindex).style.display = 'block';
+
}
+
 
+
function imageGroup(cible) {
+
 
+
    if (/^[^#]*[?&](%20)*printable=[^&#]/.test(document.URL)) {
+
        return;
+
    }
+
 
+
    var conteneur;
+
    if (cible) {
+
        conteneur = cible;
+
 
     } else {
 
     } else {
         conteneur = document.getElementById('bodyContent');
+
         for ( i = 1; i < Rows.length; i++ ) {
        if (!conteneur) { conteneur = document.getElementById('mw_contentholder'); }
+
            Rows[i].style.display = Rows[0].style.display;
         if (!conteneur) { conteneur = document.getElementById('article'); }
+
         }
         if (!conteneur) { return; }
+
         Button.firstChild.data = collapseCaption;
 
     }
 
     }
 +
};
  
     var jGroups = $(conteneur).find('div.ImageGroup');
+
function createCollapseButtons() {
 +
     var tableIndex = 0;
 +
    var NavigationBoxes = {};
 +
    var Tables = document.getElementsByTagName( 'table' );
 +
    var i;
  
     var i, il, j, jl;
+
     function handleButtonLink( index, e ) {
    var jUnits;
+
        window.collapseTable( index );
     var currentimage;
+
        e.preventDefault();
 +
     }
  
     for (i = 0, il = jGroups.length; i < il; i++) {
+
     for ( i = 0; i < Tables.length; i++ ) {
 +
        if ( $( Tables[i] ).hasClass( 'collapsible' ) ) {
  
        jUnits = jGroups.eq(i).find('div.thumb');
+
            /* only add button and increment count if there is a header row to work with */
 +
            var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
 +
            if ( !HeaderRow ) continue;
 +
            var Header = HeaderRow.getElementsByTagName( 'th' )[0];
 +
            if ( !Header ) continue;
  
        for (j = 0, jl = jUnits.length; j < jl; j++) {
+
             NavigationBoxes[ tableIndex ] = Tables[i];
             currentimage = jUnits[j];
+
             Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
             currentimage.id = 'ImageGroupsGr' + i + 'Im' + j;
+
            var imghead = document.createElement('div');
+
            imghead.style.fontSize = '110%';
+
  
             var leftArrow = document.createElement('img');
+
             var Button    = document.createElement( 'span' );
             leftArrow.src = '//upload.wikimedia.org/wikipedia/commons/thumb/4/49/ArrowLeftNavbox.svg/12px-ArrowLeftNavbox.svg.png';
+
             var ButtonLink = document.createElement( 'a' );
            leftArrow.width = '12';
+
             var ButtonText = document.createTextNode( collapseCaption );
            leftArrow.height = '12';
+
            if (j > 0) {
+
                leftArrow.alt = 'Précédent';
+
                var leftLink = document.createElement('a');
+
                leftLink.href = 'javascript:toggleImage('+i+','+j+','+(j-1)+');';
+
                leftLink.title = 'Image précédente';
+
                leftLink.appendChild(leftArrow);
+
                imghead.appendChild(leftLink);
+
             } else {
+
                leftArrow.style.visibility = 'hidden';
+
                imghead.appendChild(leftArrow);
+
            }
+
  
             $(imghead).append(' <tt>(' + (j+1) + '/' + jl + ')</tt> ');
+
             Button.className = 'collapseButton'/* Styles are declared in Common.css */
  
             var rightArrow = document.createElement('img');
+
             ButtonLink.style.color = Header.style.color;
            rightArrow.src = '//upload.wikimedia.org/wikipedia/commons/thumb/1/10/ArrowRightNavbox.svg/12px-ArrowRightNavbox.svg.png';
+
             ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
             rightArrow.width = '12';
+
             ButtonLink.setAttribute( 'href', '#' );
            rightArrow.height = '12';
+
            $( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) );
             if (j < jl - 1) {
+
             ButtonLink.appendChild( ButtonText );
                rightArrow.alt = 'Suivant';
+
                var rightLink = document.createElement('a');
+
                rightLink.href = 'javascript:toggleImage('+i+','+j+','+(j+1)+');';
+
                rightLink.title = 'Image suivante';
+
                rightLink.appendChild(rightArrow);
+
                imghead.appendChild(rightLink);
+
             } else {
+
                rightArrow.style.visibility = 'hidden';
+
                imghead.appendChild(rightArrow);
+
            }
+
  
             currentimage.insertBefore(imghead, currentimage.childNodes[0]);
+
             Button.appendChild( document.createTextNode( '[' ) );
 +
            Button.appendChild( ButtonLink );
 +
            Button.appendChild( document.createTextNode( ']' ) );
  
             if (j !== 0) {
+
             Header.insertBefore( Button, Header.firstChild );
                currentimage.style.display = 'none';
+
             tableIndex++;
             }
+
 
         }
 
         }
 
     }
 
     }
}
 
$(document).ready(function ($) {
 
    imageGroup();
 
});
 
  
/**
+
     for ( i = 0; i < tableIndex; i++ ) {
* Calcul de clés de tri pour les tableaux triables à partir des balises <span>
+
         if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
* générées par le modèle Tri1.
+
             window.collapseTable( i );
* Auteur : Zebulon84
+
         }  
*/
+
         else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
 
+
             var element = NavigationBoxes[i];
function dataSortValue(element) {
+
            while ((element = element.parentNode)) {
    var elChilds, elChild, sortValue = "", i;
+
                if ( $( element ).hasClass( 'outercollapse' ) ) {
    elChilds = element.childNodes;
+
                    window.collapseTable ( i );
     for (i = 0; i < elChilds.length; i += 1) {
+
                    break;
         elChild = elChilds[i];
+
                }
        if (hasClass(elChild, "datasortkey")) {
+
            sortValue += elChild.getAttribute("data-sort-value");
+
        } else if (elChild.nodeType === 1 && getElementsByClassName(elChild, 'span', "datasortkey").length > 0) {
+
             sortValue += dataSortValue(elChild);
+
         } else {
+
            sortValue += elChild.textContent || elChild.innerText || '';
+
         }
+
    }
+
    return sortValue;
+
}
+
 
+
function Add_dataSortValue() {
+
    var i, j, cellNodesList,
+
        sortTables = getElementsByClassName(document.body, 'table', "sortable");
+
    if (!sortTables || getElementsByClassName(document.body, 'span', "datasortkey").length === 0) {
+
        return;
+
    }
+
    for (i = 0; i < sortTables.length; i += 1) {
+
        cellNodesList = sortTables[i].getElementsByTagName('td');
+
        for (j = 0; j < cellNodesList.length; j += 1) {
+
            if (getElementsByClassName(cellNodesList[j], 'span', "datasortkey").length > 0) {
+
                cellNodesList[j].setAttribute("data-sort-value", dataSortValue(cellNodesList[j]));
+
             }
+
        }
+
        cellNodesList = sortTables[i].getElementsByTagName('th');
+
        for (j = 0; j < cellNodesList.length; j += 1) {
+
            if (getElementsByClassName(cellNodesList[j], 'span', "datasortkey").length > 0) {
+
                cellNodesList[j].setAttribute("data-sort-value", dataSortValue(cellNodesList[j]));
+
 
             }
 
             }
 
         }
 
         }
Ligne 788 : Ligne 281 :
 
}
 
}
  
addOnloadHook(Add_dataSortValue);
+
$( createCollapseButtons );
  
 
/**
 
/**
  * Utilisation du modèle Modèle:Animation
+
  * Dynamic Navigation Bars (experimental)
 +
*
 +
* Description: See [[Wikipedia:NavFrame]].
 +
* Maintainers: UNMAINTAINED
 
  */
 
  */
  
var Diaporama = new Object();
+
/* set up the words in your language */
Diaporama.Params = new Object();
+
var NavigationBarHide = '[' + collapseCaption + ']';
Diaporama.Fonctions = new Object();
+
var NavigationBarShow = '[' + expandCaption + ']';
  
Diaporama.Params.DiaporamaIndex = 0;
+
/**
Diaporama.Params.ImageDelay = 1;
+
* Shows and hides content and picture (if available) of navigation bars
Diaporama.Params.Paused = new Array();
+
* Parameters:
Diaporama.Params.Visible = new Array();
+
*    indexNavigationBar: the index of navigation bar to be toggled
Diaporama.Params.Length = new Array();
+
**/
Diaporama.Params.Delay = new Array();
+
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
Diaporama.Params.Timeout = new Array();
+
    var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
 +
    var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
 +
    var NavChild;
  
Diaporama.Fonctions.Init = function(node){
+
     if ( !NavFrame || !NavToggle ) {
     if(!node) node = document;
+
         return false;
    var Diaporamas = getElementsByClassName(node, "div", "diaporama");
+
    for(var a=0,l=Diaporamas.length;a<l;a++){
+
         Diaporama.Fonctions.InitDiaporama(Diaporamas[a]);
+
 
     }
 
     }
}
 
Diaporama.Fonctions.InitDiaporama = function(DiaporamaDiv){
 
    var index = Diaporama.Params.DiaporamaIndex;
 
    Diaporama.Params.DiaporamaIndex++;
 
    DiaporamaDiv.id = "Diaporama_"+index;
 
    var DiaporamaFileContainer = getElementsByClassName(DiaporamaDiv, "div", "diaporamaFiles")[0];
 
    var DiaporamaControl = getElementsByClassName(DiaporamaDiv, "div", "diaporamaControl")[0];
 
    if(!DiaporamaFileContainer || !DiaporamaControl) return;
 
    var DiaporamaFiles = getElementsByClassName(DiaporamaFileContainer, "div", "ImageFile");
 
    var width;
 
    var firstTumbinner = getElementsByClassName(DiaporamaFileContainer, "div", "thumbinner")[0];
 
    if(firstTumbinner){ // force la largeur du diaporama (pour IE)
 
        width = firstTumbinner.style.width.split("px").join("");
 
    }else{
 
        if(DiaporamaFileContainer.firstChild.firstChild) width = DiaporamaFileContainer.firstChild.firstChild.offsetWidth;
 
    }
 
    if(width) DiaporamaDiv.style.width = (parseInt(width)+30) + "px";
 
    if(DiaporamaFiles.length<2) return;
 
    Diaporama.Params.Length[index] = DiaporamaFiles.length;
 
    DiaporamaFileContainer.id = "DiaporamaFileContainer_"+index;
 
    DiaporamaControl.id = "DiaporamaControl_"+index;
 
    Diaporama.Params.Delay[index] = Diaporama.Params.ImageDelay;
 
    var DiaporamaDivClass = DiaporamaDiv.className.HTMLize();
 
    var ParamDelay = DiaporamaDivClass.match(/Delay[0-9]+(\.|,)?[0-9]*/);
 
    if(ParamDelay!=null){
 
        ParamDelay = parseFloat(ParamDelay[0].split("Delay").join("").split(",").join("."));
 
        if(ParamDelay && ParamDelay>0) Diaporama.Params.Delay[index] = ParamDelay;
 
    }
 
    Diaporama.Fonctions.ShowThisDiapo(index, 0);
 
    var ControlLinks = DiaporamaControl.getElementsByTagName("a");
 
    ControlLinks[0].firstChild.id = "DiaporamaPlay"+index;
 
    ControlLinks[0].href = "javascript:Diaporama.Fonctions.Play("+index+");";
 
    ControlLinks[1].firstChild.id = "DiaporamaPause"+index;
 
    ControlLinks[1].href = "javascript:Diaporama.Fonctions.Pause("+index+");";
 
    ControlLinks[2].firstChild.id = "DiaporamaStop"+index;
 
    ControlLinks[2].href = "javascript:Diaporama.Fonctions.Stop("+index+");";
 
    ControlLinks[3].firstChild.id = "DiaporamaLast"+index;
 
    ControlLinks[3].href = "javascript:Diaporama.Fonctions.ToggleDiapo("+index+",-1);";
 
    ControlLinks[4].firstChild.id = "DiaporamaNext"+index;
 
    ControlLinks[4].href = "javascript:Diaporama.Fonctions.ToggleDiapo("+index+", 1);";
 
    ControlLinks[5].parentNode.appendChild(Diaporama.Fonctions.CreateSelect(index, ControlLinks[5].title));
 
    ControlLinks[5].parentNode.removeChild(ControlLinks[5]);
 
    for(var e=0,t=ControlLinks.length;e<t;e++){
 
        ControlLinks[e].onmousedown = function(){Diaporama.Fonctions.Onclick(this);};
 
        ControlLinks[e].onmouseup = function(){Diaporama.Fonctions.Offclick(this, index);};
 
        ControlLinks[e].firstChild.style.backgroundColor = "white";
 
        ControlLinks[e].onmouseover = function(){ this.focus(); };
 
    }
 
    DiaporamaControl.style.display = "block";
 
    if(hasClass("Autoplay", DiaporamaDiv)){
 
        Diaporama.Fonctions.Play(index);
 
    }else{
 
        Diaporama.Fonctions.Pause(index);
 
    }
 
}
 
  
Diaporama.Fonctions.Play = function(index){
+
     /* if shown now */
     if(Diaporama.Params.Paused[index] === false) return;
+
     if ( NavToggle.firstChild.data === NavigationBarHide ) {
    Diaporama.Params.Paused[index] = false;
+
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
    clearTimeout(Diaporama.Params.Timeout[index]);
+
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
    Diaporama.Params.Timeout[index] = setTimeout("Diaporama.Fonctions.ToggleDiapo("+index+",1);", Diaporama.Params.Delay[index]*1000);
+
                NavChild.style.display = 'none';
     var ButtonPlay = document.getElementById("DiaporamaPlay"+index);
+
             }
    ButtonPlay.style.backgroundColor = "silver";
+
    var ButtonPause = document.getElementById("DiaporamaPause"+index);
+
    ButtonPause.style.backgroundColor = "white";
+
    var ButtonStop = document.getElementById("DiaporamaStop"+index);
+
    ButtonStop.style.backgroundColor = "white";
+
}
+
 
+
Diaporama.Fonctions.Pause = function(index){
+
    Diaporama.Params.Paused[index] = true;
+
    clearTimeout(Diaporama.Params.Timeout[index]);
+
    var ButtonPlay = document.getElementById("DiaporamaPlay"+index);
+
    ButtonPlay.style.backgroundColor = "white";
+
    var ButtonPause = document.getElementById("DiaporamaPause"+index);
+
    ButtonPause.style.backgroundColor = "silver";
+
    var ButtonStop = document.getElementById("DiaporamaStop"+index);
+
    ButtonStop.style.backgroundColor = "white";
+
}
+
 
+
Diaporama.Fonctions.Stop = function(index){
+
    Diaporama.Params.Paused[index] = true;
+
    clearTimeout(Diaporama.Params.Timeout[index]);
+
    Diaporama.Fonctions.ShowThisDiapo(index, 0);
+
    var ButtonPlay = document.getElementById("DiaporamaPlay"+index);
+
    ButtonPlay.style.backgroundColor = "white";
+
    var ButtonPause = document.getElementById("DiaporamaPause"+index);
+
    ButtonPause.style.backgroundColor = "white";
+
    var ButtonStop = document.getElementById("DiaporamaStop"+index);
+
    ButtonStop.style.backgroundColor = "silver";
+
}
+
 
+
Diaporama.Fonctions.ToggleDiapo = function(index, diff){
+
    clearTimeout(Diaporama.Params.Timeout[index]);
+
    var DiaporamaFileContainer = document.getElementById("DiaporamaFileContainer_"+index);
+
    var DiaporamaFiles = getElementsByClassName(DiaporamaFileContainer, "div", "ImageFile");
+
    var VisibleIndex = Diaporama.Params.Visible[index];
+
    var NextDiaporamaIndex = (VisibleIndex+diff);
+
    if(NextDiaporamaIndex==DiaporamaFiles.length || NextDiaporamaIndex<0){
+
        var DiaporamaDiv = document.getElementById("Diaporama_"+index);
+
        if(diff<0 || !hasClass("AutoLoop", DiaporamaDiv)){
+
             return;
+
 
         }
 
         }
        NextDiaporamaIndex = 0;
+
     NavToggle.firstChild.data = NavigationBarShow;
     }
+
    Diaporama.Fonctions.ShowThisDiapo(index, NextDiaporamaIndex);
+
}
+
  
Diaporama.Fonctions.ShowThisDiapo = function(index, Value){
+
    /* if hidden now */
     clearTimeout(Diaporama.Params.Timeout[index]);
+
     } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
    var DiaporamaFileContainer = document.getElementById("DiaporamaFileContainer_"+index);
+
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
    var DiaporamaFiles = getElementsByClassName(DiaporamaFileContainer, "div", "ImageFile");
+
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
    for(var x=0,z=DiaporamaFiles.length;x<z;x++){
+
                NavChild.style.display = 'block';
        if(x!=Value){
+
            }
            DiaporamaFiles[x].style.display = "none";
+
        }else{
+
            DiaporamaFiles[x].style.display = "block";
+
 
         }
 
         }
 +
        NavToggle.firstChild.data = NavigationBarHide;
 
     }
 
     }
    Diaporama.Params.Visible[index] = Value;
 
    Diaporama.Fonctions.UpdateBar(index);
 
    Diaporama.Fonctions.UpdateSelect(index);
 
    if(!Diaporama.Params.Paused[index]){
 
        var multipl = 1;
 
        if(Value==(Diaporama.Params.Length[index]-1)) multipl = 3;
 
        Diaporama.Params.Timeout[index] = setTimeout("Diaporama.Fonctions.ToggleDiapo("+index+",1);", Diaporama.Params.Delay[index]*1000*multipl);
 
    }
 
}
 
  
Diaporama.Fonctions.CreateSelect = function(index, Title){
+
     event.preventDefault();
     var Total = Diaporama.Params.Length[index];
+
};
    var Select = document.createElement('select');
+
    Select.id = "DiaporamaSelect"+index;
+
    Select.title = Title;
+
    for(var s=0;s<Total;s++){
+
        var Opt = document.createElement('option');
+
        if(s==0) Opt.selected = "selected";
+
        Opt.text = (s+1)+"/"+Total;
+
        Opt.innerHTML = (s+1)+"/"+Total;
+
        Opt.value = s;
+
        Select.appendChild(Opt);
+
    }
+
    Select.onchange = function(){ Diaporama.Fonctions.SelectDiapo(Diaporama.Fonctions.getIndex(this)); };
+
    Select.onmouseover = function(){ this.focus(); };
+
    return Select;
+
}
+
  
Diaporama.Fonctions.SelectDiapo = function(index){
+
/* adds show/hide-button to navigation bars */
     var Select = document.getElementById("DiaporamaSelect"+index);
+
function createNavigationBarToggleButton() {
     if(!Select) return;
+
     var indexNavigationBar = 0;
     var Opts = Select.getElementsByTagName('option');
+
     var NavFrame;
     for(var o=0,p=Opts.length;o<p;o++){
+
     var NavChild;
         if(Opts[o].selected) {
+
    /* iterate over all < div >-elements */
            var Value = parseInt(Opts[o].value);
+
    var divs = document.getElementsByTagName( 'div' );
            return Diaporama.Fonctions.ShowThisDiapo(index, Value);
+
     for ( var i = 0; (NavFrame = divs[i]); i++ ) {
        }
+
        /* if found a navigation bar */
    }
+
         if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
}
+
  
Diaporama.Fonctions.UpdateSelect = function(index){
+
            indexNavigationBar++;
    var Select = document.getElementById("DiaporamaSelect"+index);
+
            var NavToggle = document.createElement( 'a' );
    if(!Select) return;
+
            NavToggle.className = 'NavToggle';
    var Opts = Select.getElementsByTagName('option');
+
            NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
    for(var o=0,p=Opts.length;o<p;o++){
+
            NavToggle.setAttribute( 'href', '#' );
        if(o==Diaporama.Params.Visible[index]) {
+
            $( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
            Opts[o].selected = "selected";
+
        }else{
+
          Opts[o].selected = false;
+
        }
+
    }
+
}
+
  
Diaporama.Fonctions.UpdateBar = function(index){
+
            var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
    var Percent = (100/(Diaporama.Params.Length[index]-1)) * Diaporama.Params.Visible[index];
+
            /**
    if(Percent>100) Percent = 100;
+
            * Check if any children are already hidden. This loop is here for backwards compatibility:
    var DiaporamaControl = document.getElementById("DiaporamaControl_"+index);
+
            * the old way of making NavFrames start out collapsed was to manually add style="display:none"
    var DiaporamaScrollBar = getElementsByClassName(DiaporamaControl, "div", "ScrollBar")[0];
+
            * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
    DiaporamaScrollBar.style.width = Percent + "%";
+
            * the content visible without JavaScript support), the new recommended way is to add the class
}
+
            * "collapsed" to the NavFrame itself, just like with collapsible tables.
 
+
            */
Diaporama.Fonctions.Onclick = function(Link){
+
            for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
    var Image = Link.getElementsByTagName('img')[0];
+
                if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
    Image.style.backgroundColor = "gray";
+
                    if ( NavChild.style.display === 'none' ) {
}
+
                        isCollapsed = true;
 
+
                    }
Diaporama.Fonctions.Offclick = function(Link, index){
+
                 }
    var Span = Link.parentNode;
+
    var SpanClass = Span.className;
+
    var Image = Link.getElementsByTagName('img')[0];
+
    var DiapoState = Diaporama.Params.Paused[index];
+
    if( (hasClass("Play", Span) && DiapoState == false) || ( (hasClass("Pause", Span)||hasClass("Stop", Span))&&DiapoState==true) ){
+
        Image.style.backgroundColor = "silver";
+
    }else{
+
        Image.style.backgroundColor = "white";
+
    }
+
}
+
 
+
Diaporama.Fonctions.getIndex = function(Element){
+
    return parseInt(Element.id.replace(/[^0-9]/g, ""));
+
}
+
 
+
$(document).ready(function ($) {
+
    Diaporama.Fonctions.Init();
+
});
+
 
+
/**
+
* Ajout d'un style particulier aux liens interlangues vers un bon article ou
+
* un article de qualité
+
*/
+
function lienAdQouBAouPdQ() {
+
 
+
    if ( document.getElementById( "p-lang" ) ) {
+
        var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
+
 
+
        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
+
            if ( document.getElementById( InterwikiLinks[i].className + "-adq" ) ) {
+
                 InterwikiLinks[i].className += " AdQ"
+
                InterwikiLinks[i].title = "Lien vers un article de qualité.";
+
 
             }
 
             }
             else if ( document.getElementById( InterwikiLinks[i].className + "-ba" ) ) {
+
             if ( isCollapsed ) {
                InterwikiLinks[i].className += " BA"
+
                for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
                InterwikiLinks[i].title = "Lien vers un bon article.";
+
                    if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
 +
                        NavChild.style.display = 'none';
 +
                    }
 +
                }
 
             }
 
             }
             else if ( document.getElementById( InterwikiLinks[i].className + "-pdq" ) ) {
+
             var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
                 InterwikiLinks[i].className += " PdQ"
+
            NavToggle.appendChild( NavToggleText );
                InterwikiLinks[i].title = "Lien vers un portail de qualité.";
+
 
 +
            /* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
 +
            for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
 +
                 if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
 +
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
 +
                    NavFrame.childNodes[j].appendChild( NavToggle );
 +
                }
 
             }
 
             }
 +
            NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
 
         }
 
         }
 
     }
 
     }
 
}
 
}
addOnloadHook(lienAdQouBAouPdQ);
 
  
/**
+
$( createNavigationBarToggleButton );
* Permet d'afficher les catégories cachées pour les contributeurs enregistrés, en ajoutant un (+) à la manière des boîtes déroulantes
+
*/
+
function hiddencat(){
+
if(typeof(DesactiveHiddenCat)!="undefined" && DesactiveHiddenCat) return;
+
if(document.URL.indexOf("printable=yes")!=-1) return;
+
var cl = document.getElementById('catlinks'); if(!cl) return;
+
if( !(hc = document.getElementById('mw-hidden-catlinks')) ) return;
+
if( hasClass(hc, 'mw-hidden-cats-user-shown') ) return;
+
if( hasClass(hc, 'mw-hidden-cats-ns-shown') )  addClass(hc, 'mw-hidden-cats-hidden');
+
var nc = document.getElementById('mw-normal-catlinks');
+
if( !nc ) {
+
  var catline = document.createElement('div');
+
  catline.id = 'mw-normal-catlinks';
+
  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(' : '));
+
  nc = cl.insertBefore(catline, cl.firstChild);
+
}
+
else nc.appendChild(document.createTextNode(' | '));
+
var lnk = document.createElement('a');
+
lnk.id = 'mw-hidden-cats-link';
+
lnk.title = 'Cet article contient des catégories cachées';
+
lnk.style.cursor = 'pointer';
+
lnk.style.color = 'black';
+
lnk.onclick = toggleHiddenCats;
+
lnk.appendChild(document.createTextNode('[+]'));
+
hclink = nc.appendChild(lnk);
+
}
+
function toggleHiddenCats(){
+
if( hasClass(hc, 'mw-hidden-cats-hidden') ) {
+
  removeClass(hc, 'mw-hidden-cats-hidden');
+
  addClass(hc, 'mw-hidden-cat-user-shown');
+
  changeText(hclink, '[–]');
+
} else {
+
  removeClass(hc, 'mw-hidden-cat-user-shown');
+
  addClass(hc, 'mw-hidden-cats-hidden');
+
  changeText(hclink, '[+]');
+
}
+
}
+
addOnloadHook(hiddencat);
+
  
 
/**
 
/**
  * Script pour alterner entre plusieurs cartes de géolocalisation
+
  * Uploadwizard_newusers
 +
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
 +
*
 +
* Maintainers: [[User:Krimpet]]
 
  */
 
  */
 
+
function uploadwizard_newusers() {
if(( mw.config.get('wgAction')=="view" || mw.config.get('wgAction')=="purge" || mw.config.get('wgAction')=="submit")) addOnloadHook(GeoBox_Init);
+
    if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) {
 
+
        var oldDiv = document.getElementById( 'autoconfirmedusers' ),
function GeoBox_Init(Element){
+
            newDiv = document.getElementById( 'newusers' );
    if(!Element) Element = document.body;
+
        if ( oldDiv && newDiv ) {
    var cont = getElementsByClass('img_toogle', Element, 'div');
+
            var userGroups = mw.config.get( 'wgUserGroups' );
    if(cont.length==0) return;
+
            if ( userGroups ) {
    for (var i = 0,m=cont.length; i < m ; i++) {
+
                for ( var i = 0; i < userGroups.length; i++ ) {
          cont[i].id = 'img_toogle_' + i;
+
                    if ( userGroups[i] === 'autoconfirmed' ) {
          var Boxes = getElementsByClass('geobox',cont[i]);
+
                        oldDiv.style.display = 'block';
          var ToggleLinksDiv = document.createElement('ul');
+
                        newDiv.style.display = 'none';
          ToggleLinksDiv.id = 'geoboxToggleLinks_' + i;
+
                        return;
          for(var a=0,l=Boxes.length;a<l;a++){
+
                    }
              var ThisBox = Boxes[a];
+
                }
              ThisBox.id = 'geobox_' + i + "_" + a;
+
            }
              ThisBox.style.borderTop='0';
+
            oldDiv.style.display = 'none';
              var ThisAlt = ThisBox.getElementsByTagName('img')[0].alt
+
            newDiv.style.display = 'block';
              var toggle = document.createElement('a');
+
             return;
              toggle.id = 'geoboxToggle_' + i + "_" + a;
+
              toggle.appendChild(document.createTextNode(ThisAlt));
+
              toggle.href='javascript:;';
+
              toggle.onclick = function(){
+
                    GeoBox_Toggle(this);
+
                    return false;
+
              }
+
              var Li = document.createElement('li');
+
              Li.appendChild(toggle);
+
              ToggleLinksDiv.appendChild(Li);
+
              if(a==(l-1)){
+
                    Li.style.display = "none";
+
              }else{
+
                    ThisBox.style.display = "none";
+
              }
+
          }
+
          cont[i].appendChild(ToggleLinksDiv);
+
    }
+
}
+
 
+
function GeoBox_Toggle(link){
+
    var ImgToggleIndex = link.id.split('geoboxToggle_').join('').replace(/_.*/g, "");
+
    var GeoBoxIndex = link.id.replace(/.*_/g, "");
+
    var ImageToggle = document.getElementById('img_toogle_' + ImgToggleIndex);
+
    var Links = document.getElementById('geoboxToggleLinks_' + ImgToggleIndex);
+
    var Geobox = document.getElementById('geobox_' + ImgToggleIndex + "_" + GeoBoxIndex);
+
    var Link = document.getElementById('geoboxToggle_' + ImgToggleIndex + "_" + GeoBoxIndex);
+
    if( (!ImageToggle) || (!Links) || (!Geobox) || (!Link) ) return;
+
    var AllGeoboxes = getElementsByClass('geobox',ImageToggle);
+
    for(var a=0,l=AllGeoboxes.length;a<l;a++){
+
          if(AllGeoboxes[a] == Geobox){
+
              AllGeoboxes[a].style.display = "";
+
          }else{
+
              AllGeoboxes[a].style.display = "none";
+
          }
+
    }
+
    var AllToggleLinks = Links.getElementsByTagName('a');
+
    for(var a=0,l=AllToggleLinks.length;a<l;a++){
+
          if(AllToggleLinks[a] == Link){
+
              AllToggleLinks[a].parentNode.style.display = "none";
+
          }else{
+
              AllToggleLinks[a].parentNode.style.display = "";
+
          }
+
    }
+
}
+
 
+
/**
+
* permet d'ajouter un petit lien (par exemple d'aide) à la fin du titre d'une page.
+
* known bug : conflit avec le changement de titre classique.
+
* Pour les commentaires, merci de contacter [[user:Plyd|Plyd]].
+
*/
+
function rewritePageH1bis() {
+
  try {
+
    var helpPage = document.getElementById("helpPage");
+
    if (helpPage) {
+
      var helpPageURL = document.getElementById("helpPageURL");
+
      var h1 = document.getElementById('firstHeading');
+
      if (helpPageURL && h1) {
+
        h1.innerHTML = h1.innerHTML + '<span id="h1-helpPage">' + helpPageURL.innerHTML + '</span>';
+
        helpPage.style.display = "none";
+
      }
+
    }
+
  } catch (e) {
+
    /* Something went wrong. */
+
  }
+
}
+
addOnloadHook(rewritePageH1bis);
+
 
+
/**
+
* application de [[Wikipédia:Prise de décision/Système de cache]]
+
* un <span class="noarchive"> autour du lien l'empêche d'être pris en compte
+
* pour celui-ci uniquement
+
* un no_external_cache=true dans un monobook personnel désactive le script
+
*/
+
 
+
function addcache(element) {
+
 
+
    if (typeof no_external_cache !== "undefined" && no_external_cache) {
+
        return;
+
    }
+
 
+
    var liens = element ? $(element).find('ol.references').find('a.external') : $('ol.references').find('a.external');
+
    for (var i = 0, l = liens.length; i < l; i++) {
+
        var lien_en_cours = liens[i];
+
        var chemin = lien_en_cours.href;
+
        if (chemin.indexOf("http://archive.wikiwix.com/cache/") > -1 || chemin.indexOf("http://web.archive.org/web/") > -1 || chemin.indexOf("wikipedia.org") > -1 || chemin.indexOf("wikimedia.org") > -1 || chemin.indexOf("stable.toolserver.org") > -1) {
+
             continue;
+
 
         }
 
         }
        var element_parent = lien_en_cours.parentNode;
 
        if (hasClass(element_parent, "noarchive")) {
 
            continue;
 
        }
 
        var titre = getTextContent(lien_en_cours);
 
        var last = document.createElement("small");
 
        last.className = "cachelinks";
 
        last.appendChild(document.createTextNode("\u00a0["));
 
 
        var link = document.createElement("a");
 
        link.setAttribute("href", "http://archive.wikiwix.com/cache/?url=" + chemin.replace(/%/g, "%25").replace(/&/g, "%26") + "&title=" + encodeURIComponent(titre));
 
        link.setAttribute("title", "archive de " + titre);
 
        link.appendChild(document.createTextNode("archive"));
 
 
        last.appendChild(link);
 
        last.appendChild(document.createTextNode("]"));
 
 
        element_parent.insertBefore(last, lien_en_cours.nextSibling);
 
 
     }
 
     }
 
}
 
}
  
if ( mw.config.get('wgNamespaceNumber') === 0) {
+
$(uploadwizard_newusers);
    addOnloadHook(addcache);
+
}
+
 
+
$(document).ready(function ($) {
+
 
+
  /**
+
  * Rétablit l'accès clavier à la fonction de tri des tableaux
+
  */
+
 
+
  $('.sortable th').attr('tabindex',0).keypress(function(event){
+
    if ( event.which == 13 ) {
+
      $(this).click()
+
    }
+
  });
+
 
+
});
+
 
+
  
 
/**
 
/**
  * Direct imagelinks to Commons
+
  * Magic editintros ****************************************************
 
  *
 
  *
  * @source: http://www.mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons
+
  * Description: Adds editintros on disambiguation pages and BLP pages.
  * @author: [[commons:User:Krinkle]]
+
  * Maintainers: [[User:RockMFR]]
* @rev: 5
+
 
  */
 
  */
if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {
+
function addEditIntro( name ) {
        $(document).ready( function() {
+
     $( '.editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
                // Must be relative without "https://secure.wikimedia.org."
+
        el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
                // to avoid triggering 'div#content a[href ^="https://"]' lock-icons
+
    } );
                var     commonsBase = mw.config.get( 'wgServer' ) === "https://secure.wikimedia.org"
+
                                ? '/wikipedia/commons/wiki/File:'
+
                                : '//commons.wikimedia.org/wiki/File:',
+
                        localBase = mw.util.wikiGetlink( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
+
                        uploadBaseRe = new RegExp( '^' + $.escapeRE( '//upload.wikimedia.org/wikipedia/commons/' ) );
+
+
                $( 'a.image' ).attr( 'href', function( i, currVal ) {
+
                        if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {
+
                                return currVal.replace( localBase, commonsBase );
+
                        }
+
                });
+
+
        });
+
 
}
 
}
  
/************************************************************/
+
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
/* Function Strictement spécifiques à un espace de nom ou à une page */
+
    $( function () {
/************************************************************/
+
        if ( document.getElementById( 'disambigbox' ) ) {
 +
            addEditIntro( 'Template:Disambig_editintro' );
 +
        }
 +
    } );
  
// PAGE D'ACCUEIL
+
    $( function () {
if( mw.config.get('wgFormattedNamespaces')[ mw.config.get('wgNamespaceNumber') ]+":"+mw.config.get('wgTitle') == mw.config.get('wgMainPageTitle') ) {
+
        var cats = document.getElementById( 'mw-normal-catlinks' );
 
+
        if ( !cats ) {
/**
+
            return;
* changement de l'onglet et lien vers la liste complète des Wikipédias depuis l'accueil
+
        }
*/
+
        cats = cats.getElementsByTagName( 'a' );
function mainPageTransform(){
+
        for ( var i = 0; i < cats.length; i++ ) {
  $('#ca-nstab-project a').text('Accueil');
+
            if ( cats[i].title === 'Category:Living people' || cats[i].title === 'Category:Possibly living people' ) {
  addPortletLink('p-lang', '//www.wikipedia.org/', 'Liste complète', 'interwiki-listecomplete', 'Liste complète des Wikipédias');
+
                addEditIntro( 'Template:BLP_editintro' );
 +
                break;
 +
            }
 +
        }
 +
    } );
 
}
 
}
addOnloadHook(mainPageTransform);
 
 
} // FIN DU IF page d'accueil
 
 
 
 
 
 
 
// ESPACE DE NOM 'SPECIAL'
 
if( mw.config.get('wgNamespaceNumber') == -1 ) {
 
 
  
 
/**
 
/**
  * Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche,
+
  * Description: Stay on the secure server as much as possible
  * disponibles dans une boîte déroulante.
+
  * Maintainers: [[User:TheDJ]]
* Auteurs : Jakob Voss, Guillaume, importé depuis la Wiki allemande
+
* <pre><nowiki>
+
 
  */
 
  */
 
+
if ( document.location && document.location.protocol  && document.location.protocol === 'https:' ) {
function externalSearchEngines() {
+
     /* New secure servers */
  if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return;
+
     importScript( 'MediaWiki:Common.js/secure new.js' );
  if ( mw.config.get('wgCanonicalSpecialPageName') != "Search") return;
+
 
+
  var mainNode = document.getElementById("powersearch");
+
  if (!mainNode) mainNode = document.getElementById("search");
+
  if (!mainNode) return;
+
 
+
  var beforeNode = document.getElementById("mw-search-top-table");
+
  if (!beforeNode) return;
+
  beforeNode = beforeNode.nextSibling;
+
  if (!beforeNode) return;
+
 
+
  var firstEngine = "mediawiki";
+
 
+
  var choices = document.createElement("div");
+
  choices.setAttribute("id","searchengineChoices");
+
  choices.style.textAlign = "center";
+
 
+
  var lsearchbox = document.getElementById("searchText");
+
  if (!lsearchbox) return;
+
  var initValue = lsearchbox.value;
+
 
+
  var space = "";
+
 
+
  for (var id in searchEngines) {
+
     var engine = searchEngines[id];
+
if(engine.ShortName)
+
  {
+
     if (space) choices.appendChild(space);
+
    space = document.createTextNode(" ");
+
 
+
    var attr = {
+
      type: "radio",
+
      name: "searchengineselect",
+
      value: id,
+
      onFocus: "changeSearchEngine(this.value)",
+
      id: "searchengineRadio-"+id
+
    };
+
 
+
    var html = "<input";
+
    for (var a in attr) html += " " + a + "='" + attr[a] + "'";
+
    html += " />";
+
    var span = document.createElement("span");
+
    span.innerHTML = html;
+
 
+
    choices.appendChild( span );
+
    var label = document.createElement("label");
+
    label.htmlFor = "searchengineRadio-"+id;
+
    if (engine.Template.indexOf('http') == 0) {
+
      var lienMoteur = document.createElement("a");
+
      lienMoteur.href = engine.Template.replace("{searchTerms}", initValue).replace("{language}", "fr");
+
      lienMoteur.appendChild( document.createTextNode( engine.ShortName ) );
+
      label.appendChild(lienMoteur);
+
    } else {
+
      label.appendChild( document.createTextNode( engine.ShortName ) );
+
    }
+
 
+
    choices.appendChild( label );
+
  }
+
}
+
  mainNode.insertBefore(choices, beforeNode);
+
 
+
  var input = document.createElement("input");
+
  input.id = "searchengineextraparam";
+
  input.type = "hidden";
+
 
+
  mainNode.insertBefore(input, beforeNode);
+
 
+
  changeSearchEngine(firstEngine, initValue);
+
 
}
 
}
  
function changeSearchEngine(selectedId, searchTerms) {
+
/* End of mw.loader.using callback */
 
+
} );
  var currentId = document.getElementById("searchengineChoices").currentChoice;
+
/* DO NOT ADD CODE BELOW THIS LINE */
  if (selectedId == currentId) return;
+
 
+
  document.getElementById("searchengineChoices").currentChoice = selectedId;
+
  var radio = document.getElementById('searchengineRadio-'  + selectedId);
+
  radio.checked = "checked";
+
 
+
  var engine = searchEngines[selectedId];
+
  var p = engine.Template.indexOf('?');
+
  var params = engine.Template.substr(p+1);
+
 
+
  var form;
+
  if (document.forms["search"]) {
+
    form = document.forms["search"];
+
  } else {
+
    form = document.getElementById("powersearch");
+
  }
+
  form.setAttribute("action", engine.Template.substr(0,p));
+
 
+
  var l = ("" + params).split("&");
+
  for (var idx = 0;idx < l.length;idx++) {
+
    var p = l[idx].split("=");
+
    var pValue = p[1];
+
 
+
    if (pValue == "{language}") {
+
    } else if (pValue == "{searchTerms}") {
+
      var input;
+
      input = document.getElementById("searchText");
+
 
+
      input.name = p[0];
+
    } else {
+
      var input = document.getElementById("searchengineextraparam");
+
 
+
      input.name = p[0];
+
      input.value = pValue;
+
    }
+
  }
+
}
+
 
+
 
+
 
+
if ( mw.config.get('wgCanonicalSpecialPageName') == "Search") {
+
var searchEngines = {
+
  mediawiki: {
+
    ShortName: "Recherche interne",
+
    Template: mw.config.get('wgScript') + "?search={searchTerms}"
+
  },
+
  exalead: {
+
    ShortName: "Exalead",
+
    Template: "http://www.exalead.com/search/wikipedia/results/?q={searchTerms}&language=fr"
+
  },
+
  google: {
+
    ShortName: "Google",
+
    Template: "http://www.google.fr/search?as_sitesearch=fr.wikipedia.org&hl={language}&q={searchTerms}"
+
  },
+
  wikiwix: {
+
    ShortName: "Wikiwix",
+
    Template: "http://fr.wikiwix.com/index.php?action={searchTerms}&lang={language}"
+
  },
+
 
+
  wlive: {
+
    ShortName: "Bing",
+
    Template: "http://www.bing.com/search?q={searchTerms}&q1=site:http://fr.wikipedia.org"
+
  },
+
  yahoo: {
+
    ShortName: "Yahoo!",
+
    Template: "http://fr.search.yahoo.com/search?p={searchTerms}&vs=fr.wikipedia.org"
+
  },
+
globalwpsearch: {
+
    ShortName: "Global WP",
+
    Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
+
  }
+
};
+
addOnloadHook(externalSearchEngines);
+
}
+
 
+
 
+
 
+
/**
+
* Affiche un modèle Information sur la page de téléchargement de fichiers [[Spécial:Téléchargement]]
+
* Voir aussi [[MediaWiki:Onlyifuploading.js]]
+
*/
+
if( mw.config.get('wgCanonicalSpecialPageName') == "Upload" ) {
+
  importScript("MediaWiki:Onlyifuploading.js");
+
}
+
 
+
} // Fin du code concernant l'espace de nom 'Special'
+
 
+
 
+
// ESPACE DE NOM 'UTILISATEUR'
+
if( mw.config.get('wgNamespaceNumber') == 2 ) {
+
 
+
/* DÉBUT DU CODE JAVASCRIPT DE "CADRE À ONGLETS"
+
    Fonctionnement du [[Modèle:Cadre à onglets]]
+
    Modèle implanté par User:Peleguer de http://ca.wikipedia.org
+
    Actualisé par User:Joanjoc de http://ca.wikipedia.org
+
    Traduction et adaptation User:Antaya de http://fr.wikipedia.org
+
    Indépendance de classes CSS et nettoyage par User:Nemoi de http://fr.wikipedia.org
+
*/
+
 
+
function CadreOngletInitN(){
+
 
+
  var Classeurs = $('div.classeur')
+
  for ( var i = 0; i < Classeurs.length; i++ ) {
+
      var Classeur = Classeurs[i];
+
 
+
      Classeur.setAttribute( "id", "classeur" + i );
+
 
+
      var vOgIni = -1 // pour connaître l’onglet renseigné
+
 
+
      var Onglets = $(Classeur).children("div").eq(0).children("div");
+
      var Feuillets = $(Classeur).children("div").eq(1).children("div");
+
 
+
      for ( var j = 0; j < Onglets.length; j++) {
+
        var Onglet = Onglets[j];
+
        var Feuillet = Feuillets[j];
+
 
+
        Onglet.setAttribute( "id", "classeur" + i + "onglet" + j );
+
        Feuillet.setAttribute( "id", "classeur" + i + "feuillet" + j );
+
        Onglet.onclick = CadreOngletVoirOngletN;
+
 
+
        if ( hasClass( Onglet, "ongletBoutonSel") ) vOgIni=j;
+
      }
+
 
+
      // inutile sauf dans le cas où l’onglet de départ est *mal* renseigné
+
      if (vOgIni == -1) {
+
        var vOgIni = Math.floor((Onglets.length)*Math.random()) ;
+
        document.getElementById("classeur"+i+"feuillet"+vOgIni).style.display = "block";
+
        document.getElementById("classeur"+i+"feuillet"+vOgIni).style.visibility = "visible";
+
        var vBtElem = document.getElementById("classeur"+i+"onglet"+vOgIni);
+
        removeClass(Onglet, "ongletBoutonNonSel");
+
        addClass(Onglet, "ongletBoutonSel");
+
        vBtElem.style.cursor="default";
+
        vBtElem.style.backgroundColor="inherit";
+
        vBtElem.style.borderTopColor="inherit";      // propriété par propriété sinon Chrome/Chromium se loupe
+
        vBtElem.style.borderRightColor="inherit";
+
        vBtElem.style.borderBottomColor="inherit";
+
        vBtElem.style.borderLeftColor="inherit";
+
      }
+
  }
+
}
+
 
+
function CadreOngletVoirOngletN(){
+
  var vOngletNom = this.id.substr(0,this.id.indexOf("onglet",1));
+
  var vOngletIndex = this.id.substr(this.id.indexOf("onglet",0)+6,this.id.length);
+
 
+
  var rule1=$('#' + vOngletNom + ' .ongletBoutonNonSel')[0].style.backgroundColor.toString();
+
  var rule2=$('#' + vOngletNom + ' .ongletBoutonNonSel')[0].style.borderColor.toString();      //rule2=$('.ongletBoutonNonSel').css("border-color"); ne fonctionne pas sous Firefox
+
 
+
  var Onglets = $('#' + vOngletNom).children("div").eq(0).children("div")
+
 
+
  for ( var j = 0; j < Onglets.length; j++) {
+
    var Onglet = Onglets[j];
+
    var Feuillet = document.getElementById(vOngletNom + "feuillet" + j);
+
 
+
    if (vOngletIndex==j){
+
      Feuillet.style.display = "block";
+
      Feuillet.style.visibility = "visible";
+
      removeClass(Onglet, "ongletBoutonNonSel");
+
      addClass(Onglet, "ongletBoutonSel");
+
      Onglet.style.cursor="default";
+
      Onglet.style.backgroundColor="inherit";
+
      Onglet.style.borderTopColor="inherit";      // propriété par propriété sinon Chrome/Chromium se loupe
+
      Onglet.style.borderRightColor="inherit";
+
      Onglet.style.borderBottomColor="inherit";
+
      Onglet.style.borderLeftColor="inherit";
+
    } else {
+
      Feuillet.style.display = "none";
+
      Feuillet.style.visibility = "hidden";
+
      removeClass(Onglet, "ongletBoutonSel");
+
      addClass(Onglet, "ongletBoutonNonSel");
+
      Onglet.style.cursor="pointer";
+
      Onglet.style.backgroundColor=rule1;
+
      Onglet.style.borderColor=rule2;
+
    }
+
  }
+
  return false;
+
}
+
 
+
addOnloadHook(CadreOngletInitN);
+
/*FIN DU CODE JAVASCRIPT DE "CADRE À ONGLETS"*/
+
 
+
} // Fin du code concernant l'espace de nom 'Utilisateur'
+
 
+
 
+
// ESPACE DE NOM 'RÉFÉRENCE'
+
if( mw.config.get('wgNamespaceNumber') == 104 ) {
+
 
+
/*
+
* Choix du mode d'affichage des références
+
* Devraient en principe se trouver côté serveur
+
* @note L'ordre de cette liste doit correspondre a celui de Modèle:Édition !
+
*/
+
 
+
function addBibSubsetMenu() {
+
  var specialBib = document.getElementById('specialBib');
+
  if (!specialBib) return;
+
 
+
  specialBib.style.display = 'block';
+
  menu = '<select style="display:inline;" onChange="chooseBibSubset(selectedIndex)">'
+
  + '<option>Liste</option>'
+
  + '<option>WikiNorme</option>'
+
  + '<option>BibTeX</option>'
+
  + '<option>ISBD</option>'
+
  + '<option>ISO690</option>'
+
  + '</select>';
+
  specialBib.innerHTML = specialBib.innerHTML + menu;
+
 
+
  /* default subset - try to use a cookie some day */
+
  chooseBibSubset(0);
+
}
+
 
+
// select subsection of special characters
+
function chooseBibSubset(s) {
+
  var l = document.getElementsByTagName('div');
+
  for (var i = 0; i < l.length ; i++) {
+
    if(l[i].className == 'BibList')  l[i].style.display = s == 0 ? 'block' : 'none';
+
    else if(l[i].className == 'WikiNorme') l[i].style.display = s == 1 ? 'block' : 'none';
+
    else if(l[i].className == 'BibTeX')    l[i].style.display = s == 2 ? 'block' : 'none';
+
    else if(l[i].className == 'ISBD')      l[i].style.display = s == 3 ? 'block' : 'none';
+
    else if(l[i].className == 'ISO690')    l[i].style.display = s == 4 ? 'block' : 'none';
+
  }
+
}
+
addOnloadHook(addBibSubsetMenu);
+
} // Fin du code concernant l'espace de nom 'Référence'
+
 
+
 
+
/* Permet d'afficher un compte à rebours sur une page avec le modèle [[Modèle:Compte à rebours]] */
+
/* Plyd - 3 février 2009 */
+
function Rebours() {
+
  if( mw.config.get('wgNamespaceNumber') ==0) return;
+
  try {
+
  if (document.getElementById("rebours")) {
+
      destime = document.getElementById("rebours").title.HTMLize().split(";;");
+
      Maintenant = (new Date).getTime();
+
      Future = new Date(Date.UTC(destime[0], (destime[1]-1), destime[2], destime[3], destime[4], destime[5])).getTime();
+
      Diff = (Future-Maintenant);
+
      if (Diff < 0) {Diff = 0}
+
      TempsRestantJ = Math.floor(Diff/(24*3600*1000));
+
      TempsRestantH = Math.floor(Diff/(3600*1000)) % 24;
+
      TempsRestantM = Math.floor(Diff/(60*1000)) % 60;
+
      TempsRestantS = Math.floor(Diff/1000) % 60;
+
      TempsRestant = "" + destime[6] + " ";
+
      if (TempsRestantJ == 1) {
+
        TempsRestant = TempsRestant + TempsRestantJ + " jour ";
+
      } else if (TempsRestantJ > 1) {
+
        TempsRestant = TempsRestant + TempsRestantJ + " jours ";
+
      }
+
      TempsRestant = TempsRestant + TempsRestantH + " h " + TempsRestantM  + " min " + TempsRestantS + " s";
+
      document.getElementById("rebours").innerHTML = TempsRestant;
+
      setTimeout("Rebours()", 1000)
+
    }
+
  } catch (e) {}
+
}
+
addOnloadHook(Rebours);
+
 
+
 
+
/* Ajoute la date de dernière modification sur le bandeau événement récent */
+
/* Plyd - 12 juin 2009 */
+
function LastModCopy() {
+
  var LastModSpan = document.getElementById('lastmod');                          // Monobook et affiliés, Modern
+
  if(!LastModSpan) LastModSpan = document.getElementById('footer-info-lastmod'); // Vector
+
  var LastModBandeau = document.getElementById("lastmodcopy");
+
  if((!LastModSpan)||(!LastModBandeau)) return;
+
  LastModBandeau.innerHTML = LastModSpan.innerHTML;
+
 
+
}
+
addOnloadHook(LastModCopy);
+
 
+
/*********************************/
+
/* Autres fonctions non classées */
+
/*********************************/
+
 
+
/*
+
* Fonction
+
*
+
* Récupère la valeur d'une variable globale en gérant le cas lorsque cette variable n'existe pas
+
* @param nom_variable Nom de la variable dont on veut connaître la valeur
+
* @param val_defaut Valeur par défaut si la variable n'existe pas
+
* @return La valeur de la variable, ou val_defaut si la variable n'existe pas
+
*
+
* Auteur : Sanao
+
* Dernière révision : 22 novembre 2007
+
*/
+
function getVarValue(nom_variable, val_defaut)
+
{
+
var result = null;
+
 
+
try {
+
result = eval(nom_variable.toString());
+
} catch (e) {
+
result = val_defaut;
+
}
+
 
+
return(result);
+
}
+
 
+
/*
+
* Fonction
+
*
+
* Retourne une chaîne de caractères de la date courante selon dans un certain format
+
* @param format Format de la date "j" pour le jour, "m" pour le mois et "a" pour l'année. Ainsi si l'on est le 21 novembre 2007 et l'on passe en paramètre cette chaîne "a_m_d", la chaîne retournée sera "2007_novembre_21"
+
* Auteur : Sanao
+
* Dernière révision : 21 novembre 2007
+
*/
+
function getStrDateToday(format)
+
{
+
  var str_mois = new Array();
+
  with (str_mois)
+
  {
+
    push("janvier");
+
    push("février");
+
    push("mars");
+
    push("avril");
+
    push("mai");
+
    push("juin");
+
    push("juillet");
+
    push("août");
+
    push("septembre");
+
    push("octobre");
+
    push("novembre");
+
    push("décembre");
+
  }
+
  var today = new Date();
+
  var day = today.getDate();
+
  var year = today.getYear();
+
  if (year < 2000)
+
  {
+
    year = year + 1900;
+
  }
+
  var str_date = format;
+
 
+
  //Création de la chaîne
+
  var regex = /j/gi;
+
  str_date = str_date.replace(regex, day.toString());
+
  regex = /a/gi;
+
  str_date = str_date.replace(regex, year.toString());
+
  regex = /m/gi;
+
  str_date = str_date.replace(regex, str_mois[today.getMonth()]);
+
 
+
  return (str_date);
+
}
+
 
+
/* petites fonctions pratiques  - Darkoneko, 09/01/2008 */
+
 
+
//créé un lien et le retourne.
+
//le parametre onclick est facultatif.
+
function createAdressNode(href, texte, onclick) {
+
  var a = document.createElement('a')
+
  a.href = href
+
  a.appendChild(document.createTextNode( texte ) )
+
  if(arguments.length == 3) {  a.setAttribute("onclick", onclick )  }
+
 
+
  return a
+
}
+
 
+
//Créé un cookie. il n'existais qu'une version dédiée à l'accueil. Celle ci est plus générique
+
//le parametre duree est en jours
+
function setCookie(nom, valeur, duree ) {
+
  var expDate = new Date()
+
  expDate.setTime(expDate.getTime() + ( duree * 24 * 60 * 60 * 1000))
+
  document.cookie = nom + "=" + escape(valeur) + ";expires=" + expDate.toGMTString() + ";path=/"
+
}
+

Version actuelle en date du 30 mars 2013 à 04:01

/**
 * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
 * loaded for all users on every wiki page. If possible create a gadget that is
 * enabled by default instead of adding it here (since gadgets are fully
 * optimized ResourceLoader modules with possibility to add dependencies etc.)
 *
 * Since Common.js isn't a gadget, there is no place to declare its
 * dependencies, so we have to lazy load them with mw.loader.using on demand and
 * then execute the rest in the callback. In most cases these dependencies will
 * be loaded (or loading) already and the callback will not be delayed. In case a
 * dependency hasn't arrived yet it'll make sure those are loaded before this.
 */
/*global mw, $, importStylesheet, importScript */
/*jshint curly:false eqnull:true, strict:false, browser:true, */
mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () {
/* Begin of mw.loader.using callback */
 
/**
 * Main Page layout fixes
 *
 * Description: Adds an additional link to the complete list of languages available.
 * Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
 */
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
    $( document ).ready( function () {
        mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
            'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
    } );
}
 
/**
 * Redirect User:Name/skin.js and skin.css to the current skin's pages
 * (unless the 'skin' page really exists)
 * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
 * @rev: 2
 */
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
    var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
    /* Make sure there was a part before and after the slash
       and that the latter is 'skin.js' or 'skin.css' */
    if ( titleParts.length == 2 ) {
        var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
        if ( titleParts.slice( -1 ) == 'skin.js' ) {
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
        } else if ( titleParts.slice( -1 ) == 'skin.css' ) {
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
        }
    }
}
 
/**
 * Map addPortletLink to mw.util 
 *
 * @deprecated: Use mw.util.addPortletLink instead.
 */
window.addPortletLink = function () {
    return mw.util.addPortletLink.apply( mw.util, arguments );
};
 
/**
 * Extract a URL parameter from the current URL
 *
 * @deprecated: Use mw.util.getParamValue with proper escaping
 */
window.getURLParamValue = function () {
    return mw.util.getParamValue.apply( mw.util, arguments );
};
 
/** 
 * Test if an element has a certain class
 *
 * @deprecated:  Use $(element).hasClass() instead.
 */
window.hasClass = function ( element, className ) {
    return $( element ).hasClass( className );
};
 
/**
 * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
 * @rev 5
 */
// CSS
var extraCSS = mw.util.getParamValue( 'withCSS' );
if ( extraCSS ) {
	if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
		importStylesheet( extraCSS );
	} else {
		mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
	}
}
 
// JS
var extraJS = mw.util.getParamValue( 'withJS' );
if ( extraJS ) {
	if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
		importScript( extraJS );
	} else {
		mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
	}
}
 
/**
 * Import more specific scripts if necessary
 */
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
    /* scripts specific to editing pages */
    importScript( 'MediaWiki:Common.js/edit.js' );
} else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {
    /* watchlist scripts */
    importScript( 'MediaWiki:Common.js/watchlist.js' );
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
    /* file description page scripts */
    importScript( 'MediaWiki:Common.js/file.js' );
}
 
/**
 * Load scripts specific to Internet Explorer
 */
if ( $.client.profile().name === 'msie' ) {
    importScript( 'MediaWiki:Common.js/IEFixes.js' );
}
 
/**
 * Fix for Windows XP Unicode font rendering
 */
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) {
    mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' + 
                '.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' );
}
 
/**
 * WikiMiniAtlas
 *
 * Description: WikiMiniAtlas is a popup click and drag world map.
 *              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
 *              The script itself is located on meta because it is used by many projects.
 *              See [[Meta:WikiMiniAtlas]] for more information. 
 * Maintainers: [[User:Dschwen]]
 */
( function () {
    var require_wikiminiatlas = false;
    var coord_filter = /geohack/;
    $( document ).ready( function() {
        $( 'a.external.text' ).each( function( key, link ) {
            if ( link.href && coord_filter.exec( link.href ) ) {
                require_wikiminiatlas = true;
                // break from loop
                return false;
            }
        } );
        if ( $( 'div.kmldata' ).length ) {
            require_wikiminiatlas = true;
        }
        if ( require_wikiminiatlas ) {
            mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
        }
    } );
} )();
 
/**
 * Interwiki links to featured articles ***************************************
 *
 * Description: Highlights interwiki links to featured articles (or
 *              equivalents) by changing the bullet before the interwiki link
 *              into a star.
 * Maintainers: [[User:R. Koot]]
 */
function LinkFA() {
    if ( document.getElementById( 'p-lang' ) ) {
        var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
 
        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
            if ( document.getElementById( InterwikiLinks[i].className + '-fa' ) ) {
                InterwikiLinks[i].className += ' FA';
                InterwikiLinks[i].title = 'This is a featured article in another language.';
            } else if ( document.getElementById( InterwikiLinks[i].className + '-ga' ) ) {
                InterwikiLinks[i].className += ' GA';
                InterwikiLinks[i].title = 'This is a good article in another language.';
            }
        }
    }
}
 
$( LinkFA );
 
/**
 * Collapsible tables *********************************************************
 *
 * Description: Allows tables to be collapsed, showing only the header. See
 *              [[Wikipedia:NavFrame]].
 * Maintainers: [[User:R. Koot]]
 */
 
var autoCollapse = 2;
var collapseCaption = 'hide';
var expandCaption = 'show';
 
window.collapseTable = function ( tableIndex ) {
    var Button = document.getElementById( 'collapseButton' + tableIndex );
    var Table = document.getElementById( 'collapsibleTable' + tableIndex );
 
    if ( !Table || !Button ) {
        return false;
    }
 
    var Rows = Table.rows;
    var i;
 
    if ( Button.firstChild.data === collapseCaption ) {
        for ( i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = 'none';
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
};
 
function createCollapseButtons() {
    var tableIndex = 0;
    var NavigationBoxes = {};
    var Tables = document.getElementsByTagName( 'table' );
    var i;
 
    function handleButtonLink( index, e ) {
        window.collapseTable( index );
        e.preventDefault();
    }
 
    for ( i = 0; i < Tables.length; i++ ) {
        if ( $( Tables[i] ).hasClass( 'collapsible' ) ) {
 
            /* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
            if ( !HeaderRow ) continue;
            var Header = HeaderRow.getElementsByTagName( 'th' )[0];
            if ( !Header ) continue;
 
            NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
 
            var Button     = document.createElement( 'span' );
            var ButtonLink = document.createElement( 'a' );
            var ButtonText = document.createTextNode( collapseCaption );
 
            Button.className = 'collapseButton';  /* Styles are declared in Common.css */
 
            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
            ButtonLink.setAttribute( 'href', '#' );
            $( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) );
            ButtonLink.appendChild( ButtonText );
 
            Button.appendChild( document.createTextNode( '[' ) );
            Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( ']' ) );
 
            Header.insertBefore( Button, Header.firstChild );
            tableIndex++;
        }
    }
 
    for ( i = 0;  i < tableIndex; i++ ) {
        if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
            window.collapseTable( i );
        } 
        else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
            var element = NavigationBoxes[i];
            while ((element = element.parentNode)) {
                if ( $( element ).hasClass( 'outercollapse' ) ) {
                    window.collapseTable ( i );
                    break;
                }
            }
        }
    }
}
 
$( createCollapseButtons );
 
/**
 * Dynamic Navigation Bars (experimental)
 *
 * Description: See [[Wikipedia:NavFrame]].
 * Maintainers: UNMAINTAINED
 */
 
/* set up the words in your language */
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
 
/**
 * Shows and hides content and picture (if available) of navigation bars
 * Parameters:
 *     indexNavigationBar: the index of navigation bar to be toggled
 **/
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
    var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
    var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
    var NavChild;
 
    if ( !NavFrame || !NavToggle ) {
        return false;
    }
 
    /* if shown now */
    if ( NavToggle.firstChild.data === NavigationBarHide ) {
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
                NavChild.style.display = 'none';
            }
        }
    NavToggle.firstChild.data = NavigationBarShow;
 
    /* if hidden now */
    } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
                NavChild.style.display = 'block';
            }
        }
        NavToggle.firstChild.data = NavigationBarHide;
    }
 
    event.preventDefault();
};
 
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton() {
    var indexNavigationBar = 0;
    var NavFrame;
    var NavChild;
    /* iterate over all < div >-elements */
    var divs = document.getElementsByTagName( 'div' );
    for ( var i = 0; (NavFrame = divs[i]); i++ ) {
        /* if found a navigation bar */
        if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
 
            indexNavigationBar++;
            var NavToggle = document.createElement( 'a' );
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
            NavToggle.setAttribute( 'href', '#' );
            $( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
 
            var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
            /**
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
             * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
             * the content visible without JavaScript support), the new recommended way is to add the class
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
             */
            for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
                if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
                    if ( NavChild.style.display === 'none' ) {
                        isCollapsed = true;
                    }
                }
            }
            if ( isCollapsed ) {
                for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
                    if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
            NavToggle.appendChild( NavToggleText );
 
            /* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
            for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
                if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
                    NavFrame.childNodes[j].appendChild( NavToggle );
                }
            }
            NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
        }
    }
}
 
$( createNavigationBarToggleButton );
 
/**
 * Uploadwizard_newusers
 * Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
 *
 * Maintainers: [[User:Krimpet]]
 */
function uploadwizard_newusers() {
    if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) {
        var oldDiv = document.getElementById( 'autoconfirmedusers' ),
            newDiv = document.getElementById( 'newusers' );
        if ( oldDiv && newDiv ) {
            var userGroups = mw.config.get( 'wgUserGroups' );
            if ( userGroups ) {
                for ( var i = 0; i < userGroups.length; i++ ) {
                    if ( userGroups[i] === 'autoconfirmed' ) {
                        oldDiv.style.display = 'block';
                        newDiv.style.display = 'none';
                        return;
                    }
                }
            }
            oldDiv.style.display = 'none';
            newDiv.style.display = 'block';
            return;
        }
    }
}
 
$(uploadwizard_newusers);
 
/**
 * Magic editintros ****************************************************
 *
 * Description: Adds editintros on disambiguation pages and BLP pages.
 * Maintainers: [[User:RockMFR]]
 */
function addEditIntro( name ) {
    $( '.editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
        el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
    } );
}
 
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
    $( function () {
        if ( document.getElementById( 'disambigbox' ) ) {
            addEditIntro( 'Template:Disambig_editintro' );
        }
    } );
 
    $( function () {
        var cats = document.getElementById( 'mw-normal-catlinks' );
        if ( !cats ) {
            return;
        }
        cats = cats.getElementsByTagName( 'a' );
        for ( var i = 0; i < cats.length; i++ ) {
            if ( cats[i].title === 'Category:Living people' || cats[i].title === 'Category:Possibly living people' ) {
                addEditIntro( 'Template:BLP_editintro' );
                break;
            }
        }
    } );
}
 
/**
 * Description: Stay on the secure server as much as possible
 * Maintainers: [[User:TheDJ]]
 */
if ( document.location && document.location.protocol  && document.location.protocol === 'https:' ) {
    /* New secure servers */
    importScript( 'MediaWiki:Common.js/secure new.js' );
}
 
/* End of mw.loader.using callback */
} );
/* DO NOT ADD CODE BELOW THIS LINE */
Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Boîte à outils
Partager