Bienvenue sur le wiki de Nuit debout, nous sommes le 2991 mars.




MediaWiki:Common.js : Différence entre versions

De NuitDebout
Aller à : navigation, rechercher
 
(78 révisions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
 
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
 
 
// Affiche un lien "Sous-pages" dans les outils.
 
// Affiche un lien "Sous-pages" dans les outils.
 
+
var subPagesLink = function($) {
var subPagesLink = function ($) {
+
    var NSWithoutSubpages = new Array(-1, 6, 14, 104, 105);
  var NSWithoutSubpages = new Array(-1, 6, 14, 104, 105);
+
    if (NSWithoutSubpages.indexOf(mw.config.get('wgNamespaceNumber')) == -1) {
  if (NSWithoutSubpages.indexOf(mw.config.get('wgNamespaceNumber')) == -1){
+
        mw.util.addPortletLink('p-tb', mw.config.get('wgServer') + '/wiki/Spécial:Index/' + mw.config.get('wgPageName') + '/', 'Sous-pages');
    mw.util.addPortletLink( 'p-tb', mw.config.get('wgServer')+'/wiki/Spécial:Index/' + mw.config.get('wgPageName') + '/', 'Sous-pages');
+
    }
  }
+
 
}
 
}
 
$(document).ready(subPagesLink);
 
$(document).ready(subPagesLink);
Ligne 23 : Ligne 21 :
 
var Palette_max = 1;
 
var Palette_max = 1;
  
function Palette_toggle( $table ) {
+
function Palette_toggle($table) {
$table.find( 'tr:not(:first)' ).toggleClass( 'navboxHidden' );
+
    $table.find('tr:not(:first)').toggleClass('navboxHidden');
 
}
 
}
  
function Palette( element ) {
+
function Palette(element) {
if ( !element ) {
+
    if (!element) {
element = document;
+
        element = document;
}
+
    }
var $tables = $( element ).find( 'table.collapsible' );
+
    var $tables = $(element).find('table.collapsible');
var autoCollapse = $tables.length > Palette_max;
+
    var autoCollapse = $tables.length > Palette_max;
  
$.each( $tables, function( _, table ) {
+
    $.each($tables, function(_, table) {
var $table = $( table );
+
        var $table = $(table);
var collapsed = $table.hasClass( 'collapsed' ) || ( autoCollapse && $table.hasClass( 'autocollapse' ) );
+
        var collapsed = $table.hasClass('collapsed') || (autoCollapse && $table.hasClass('autocollapse'));
$table.find( 'tr:first th:first' ).prepend(
+
        $table.find('tr:first th:first').prepend(
$( '<span class="navboxToggle">\u00a0</span>' ).append(
+
            $('<span class="navboxToggle">\u00a0</span>').append(
$( '<a href="#">' + (collapsed ? Palette_Derouler : Palette_Enrouler) + '</a>' ).click( function() {
+
                $('<a href="#">' + (collapsed ? Palette_Derouler : Palette_Enrouler) + '</a>').click(function() {
if ( $( this ).text() === Palette_Enrouler ) {
+
                    if ($(this).text() === Palette_Enrouler) {
$( this ).text( Palette_Derouler );
+
                        $(this).text(Palette_Derouler);
} else {
+
                    } else {
$( this ).text( Palette_Enrouler );
+
                        $(this).text(Palette_Enrouler);
}
+
                    }
Palette_toggle( $table );
+
                    Palette_toggle($table);
return false;
+
                    return false;
} )
+
                })
)
+
            )
);
+
        );
if ( collapsed ) {
+
        if (collapsed) {
Palette_toggle( $table );
+
            Palette_toggle($table);
}
+
        }
} );
+
    });
 
}
 
}
$( function() {
+
$(function() {
Palette();
+
    Palette();
} );
+
});
  
  
Ligne 69 : Ligne 67 :
 
var BoiteDeroulante_index = -1;
 
var BoiteDeroulante_index = -1;
  
function BoiteDeroulante_toggle(indexBoiteDeroulante){
+
function BoiteDeroulante_toggle(indexBoiteDeroulante) {
var NavFrame = document.getElementById("NavFrame" + indexBoiteDeroulante);
+
    var NavFrame = document.getElementById("NavFrame" + indexBoiteDeroulante);
var NavToggle = document.getElementById("NavToggle" + indexBoiteDeroulante);
+
    var NavToggle = document.getElementById("NavToggle" + indexBoiteDeroulante);
var CaptionContainer = document.getElementById("NavCaption" + indexBoiteDeroulante);
+
    var CaptionContainer = document.getElementById("NavCaption" + indexBoiteDeroulante);
if (!NavFrame || !NavToggle || !CaptionContainer) return;
+
    if (!NavFrame || !NavToggle || !CaptionContainer) return;
var caption = [];
+
    var caption = [];
var CaptionSpans = CaptionContainer.getElementsByTagName('span');
+
    var CaptionSpans = CaptionContainer.getElementsByTagName('span');
caption[0] = CaptionSpans[0].innerHTML;
+
    caption[0] = CaptionSpans[0].innerHTML;
caption[1] = CaptionSpans[1].innerHTML;
+
    caption[1] = CaptionSpans[1].innerHTML;
  
var Contents = NavFrame.getElementsByTagName('div');
+
    var Contents = NavFrame.getElementsByTagName('div');
if (NavToggle.innerHTML == caption[1]) {
+
    if (NavToggle.innerHTML == caption[1]) {
NavToggle.innerHTML = caption[0];
+
        NavToggle.innerHTML = caption[0];
for(var a=0,m=Contents.length;a<m;a++){
+
        for (var a = 0, m = Contents.length; a < m; a++) {
if( $( Contents[a] ).hasClass( 'NavContent' ) ){
+
            if ($(Contents[a]).hasClass('NavContent')) {
Contents[a].style.display = 'none';
+
                Contents[a].style.display = 'none';
return;
+
                return;
}
+
            }
}
+
        }
}else{
+
    } else {
NavToggle.innerHTML = caption[1];
+
        NavToggle.innerHTML = caption[1];
for(var a=0,m=Contents.length;a<m;a++){
+
        for (var a = 0, m = Contents.length; a < m; a++) {
if($(Contents[a]).hasClass("NavContent")){
+
            if ($(Contents[a]).hasClass("NavContent")) {
Contents[a].style.display = 'block';
+
                Contents[a].style.display = 'block';
return;
+
                return;
}
+
            }
}
+
        }
}
+
    }
 
}
 
}
  
function BoiteDeroulante(Element){
+
function BoiteDeroulante(Element) {
if(!Element) Element = document;
+
    if (!Element) Element = document;
var NavFrameCount = -1;
+
    var NavFrameCount = -1;
var NavFrames = Element.getElementsByTagName("div");
+
    var NavFrames = Element.getElementsByTagName("div");
for(var i=0,l=NavFrames.length;i<l;i++){
+
    for (var i = 0, l = NavFrames.length; i < l; i++) {
if( $( NavFrames[i] ).hasClass( 'NavFrame' ) ){
+
        if ($(NavFrames[i]).hasClass('NavFrame')) {
var NavFrame = NavFrames[i];
+
            var NavFrame = NavFrames[i];
NavFrameCount++;
+
            NavFrameCount++;
BoiteDeroulante_index++;
+
            BoiteDeroulante_index++;
  
if (NavFrame.title && NavFrame.title.indexOf("/")!=-1) {
+
            if (NavFrame.title && NavFrame.title.indexOf("/") != -1) {
var Enrouler = NavFrame.title.HTMLize().split("/")[1];
+
                var Enrouler = NavFrame.title.HTMLize().split("/")[1];
var Derouler = NavFrame.title.HTMLize().split("/")[0];
+
                var Derouler = NavFrame.title.HTMLize().split("/")[0];
}else{
+
            } else {
var Enrouler = BoiteDeroulante_Enrouler;
+
                var Enrouler = BoiteDeroulante_Enrouler;
var Derouler = BoiteDeroulante_Derouler;
+
                var Derouler = BoiteDeroulante_Derouler;
}
+
            }
NavFrame.title='';
+
            NavFrame.title = '';
var CaptionContainer = document.createElement('span');
+
            var CaptionContainer = document.createElement('span');
CaptionContainer.id = 'NavCaption' + BoiteDeroulante_index;
+
            CaptionContainer.id = 'NavCaption' + BoiteDeroulante_index;
CaptionContainer.style.display = "none";
+
            CaptionContainer.style.display = "none";
CaptionContainer.innerHTML = '<span>' + Derouler + '</span><span>' + Enrouler + '</span>';
+
            CaptionContainer.innerHTML = '<span>' + Derouler + '</span><span>' + Enrouler + '</span>';
NavFrame.appendChild(CaptionContainer);
+
            NavFrame.appendChild(CaptionContainer);
  
var NavToggle = document.createElement("a");
+
            var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
+
            NavToggle.className = 'NavToggle';
NavToggle.id = 'NavToggle' + BoiteDeroulante_index;
+
            NavToggle.id = 'NavToggle' + BoiteDeroulante_index;
NavToggle.href = 'javascript:BoiteDeroulante_toggle(' + BoiteDeroulante_index + ');';
+
            NavToggle.href = 'javascript:BoiteDeroulante_toggle(' + BoiteDeroulante_index + ');';
var NavToggleText = document.createTextNode(Enrouler);
+
            var NavToggleText = document.createTextNode(Enrouler);
NavToggle.appendChild(NavToggleText);
+
            NavToggle.appendChild(NavToggleText);
  
NavFrame.insertBefore( NavToggle, NavFrame.firstChild );
+
            NavFrame.insertBefore(NavToggle, NavFrame.firstChild);
NavFrame.id = 'NavFrame' + BoiteDeroulante_index;
+
            NavFrame.id = 'NavFrame' + BoiteDeroulante_index;
if (BoiteDeroulante_max <= NavFrameCount) {
+
            if (BoiteDeroulante_max <= NavFrameCount) {
BoiteDeroulante_toggle(BoiteDeroulante_index);
+
                BoiteDeroulante_toggle(BoiteDeroulante_index);
}
+
            }
}
+
        }
}
+
    }
  
 
}
 
}
  
mw.hook( 'wikipage.content' ).add( function() {
+
mw.hook('wikipage.content').add(function() {
BoiteDeroulante();
+
    BoiteDeroulante();
} );
+
});
  
  
Ligne 209 : Ligne 207 :
 
// Icônes pour signifier l'existence ou non de la catégorie choisie
 
// Icônes pour signifier l'existence ou non de la catégorie choisie
 
window.hotcat_exists_size = 20;
 
window.hotcat_exists_size = 20;
window.hotcat_exists_yes = "//upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ;
+
window.hotcat_exists_yes = "//upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png";
window.hotcat_exists_no = "//upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ;
+
window.hotcat_exists_no = "//upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png";
  
 
// Lien vers la documentation
 
// Lien vers la documentation
Ligne 282 : Ligne 280 :
  
 
window.hotcat_text_HotCatTag = "";
 
window.hotcat_text_HotCatTag = "";
if(mw.config.get( 'wgServer' ) == '//fr.wikipedia.org') window.hotcat_text_HotCatTag = "HotCats";
+
if (mw.config.get('wgServer') == '//fr.wikipedia.org') window.hotcat_text_HotCatTag = "HotCats";
  
  
Ligne 288 : Ligne 286 :
  
 
window.hotcat_text_SystemMessage = {
 
window.hotcat_text_SystemMessage = {
  "red-link-title" : false,
+
    "red-link-title": false,
  "pagecategorieslink" : false,
+
    "pagecategorieslink": false,
  "categories" : false,
+
    "categories": false,
  "pagecategories" : false
+
    "pagecategories": false
 
};
 
};
  
  
window.hotcat_Multi_Edit = false ;
+
window.hotcat_Multi_Edit = false;
window.hotcat_suggest_running = 0 ;
+
window.hotcat_suggest_running = 0;
window.hotcat_running = 0 ;
+
window.hotcat_running = 0;
window.hotcat_last_v = "" ;
+
window.hotcat_last_v = "";
 
window.hotcat_last_key = "";
 
window.hotcat_last_key = "";
 
window.hotcat_OldDefaultSort = "";
 
window.hotcat_OldDefaultSort = "";
Ligne 304 : Ligne 302 :
 
window.hotcat_Form_Index = 1000;
 
window.hotcat_Form_Index = 1000;
 
window.hotcat_NewCatsIndex = 2000;
 
window.hotcat_NewCatsIndex = 2000;
window.hotcat_CatNamespace = mw.config.get('wgFormattedNamespaces')[14]+':';
+
window.hotcat_CatNamespace = mw.config.get('wgFormattedNamespaces')[14] + ':';
 
window.hotcat_DefaultsortAliases = [];
 
window.hotcat_DefaultsortAliases = [];
window.hotcat_Multi_IsEditPage = ((mw.config.get('wgAction')=="edit")||(mw.config.get('wgAction')=="submit")) ;
+
window.hotcat_Multi_IsEditPage = ((mw.config.get('wgAction') == "edit") || (mw.config.get('wgAction') == "submit"));
window.hotcat_Multi_IsSection = false ;
+
window.hotcat_Multi_IsSection = false;
  
 
window.hotcat_SpanMatrix = [];
 
window.hotcat_SpanMatrix = [];
Ligne 324 : Ligne 322 :
  
 
window.hotcat_ajax = {
 
window.hotcat_ajax = {
  http: function(bundle) {
+
    http: function(bundle) {
    var xmlhttp;
+
        var xmlhttp;
    try {
+
      xmlhttp = new XMLHttpRequest();
+
    } catch(e) {
+
      try {
+
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+
      } catch (e) {
+
 
         try {
 
         try {
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+
            xmlhttp = new XMLHttpRequest();
 
         } catch (e) {
 
         } catch (e) {
          xmlhttp = false;
+
            try {
 +
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 +
            } catch (e) {
 +
                try {
 +
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 +
                } catch (e) {
 +
                    xmlhttp = false;
 +
                }
 +
            }
 +
        }
 +
        if (xmlhttp) {
 +
            xmlhttp.onreadystatechange = function() {
 +
                if (xmlhttp.readyState == 4)
 +
                    hotcat_ajax.httpComplete(xmlhttp, bundle);
 +
            };
 +
            xmlhttp.open(bundle.method ? bundle.method : "GET", bundle.url, bundle.async === false ? false : true);
 +
            if (bundle.headers) {
 +
                for (var field in bundle.headers)
 +
                    try {
 +
                        xmlhttp.setRequestHeader(field, bundle.headers[field]);
 +
                    } catch (err) {}
 +
            }
 +
            xmlhttp.send(bundle.data ? bundle.data : null);
 +
        }
 +
        return xmlhttp;
 +
    },
 +
    httpComplete: function(xmlhttp, bundle) {
 +
        if (xmlhttp.status == 200 || xmlhttp.status == 302) {
 +
            if (bundle.onSuccess) bundle.onSuccess(xmlhttp, bundle);
 +
        } else if (bundle.onFailure) {
 +
            bundle.onFailure(xmlhttp, bundle);
 
         }
 
         }
      }
 
 
     }
 
     }
    if (xmlhttp) {
 
      xmlhttp.onreadystatechange = function() {
 
        if (xmlhttp.readyState == 4)
 
          hotcat_ajax.httpComplete(xmlhttp,bundle);
 
      };
 
      xmlhttp.open(bundle.method ? bundle.method : "GET",bundle.url,bundle.async === false ? false : true);
 
      if (bundle.headers) {
 
        for (var field in bundle.headers)
 
          try {
 
            xmlhttp.setRequestHeader(field,bundle.headers[field]);
 
          } catch(err) {  }
 
      }
 
      xmlhttp.send(bundle.data ? bundle.data : null);
 
    }
 
    return xmlhttp;
 
  },
 
  httpComplete: function(xmlhttp,bundle) {
 
    if (xmlhttp.status == 200 || xmlhttp.status == 302) {
 
      if (bundle.onSuccess) bundle.onSuccess(xmlhttp,bundle);
 
    } else if (bundle.onFailure) {
 
      bundle.onFailure(xmlhttp,bundle);
 
    }
 
  }
 
 
};
 
};
  
Ligne 374 : Ligne 372 :
 
window.hotcat_SetCookie = function(cookieName, cookieValue) {
 
window.hotcat_SetCookie = function(cookieName, cookieValue) {
 
     var now = new Date();
 
     var now = new Date();
     var nextYear = new Date(now.getTime() + 1000 * 60 * 60 * 24 * 365 );
+
     var nextYear = new Date(now.getTime() + 1000 * 60 * 60 * 24 * 365);
     return jQuery.cookie(cookieName, cookieValue, {expires:nextYear, path:"/"});
+
     return jQuery.cookie(cookieName, cookieValue, {
 +
        expires: nextYear,
 +
        path: "/"
 +
    });
 
};
 
};
  
Ligne 384 : Ligne 385 :
 
};
 
};
  
window.hotcat_getDefaultsortAliasesAndMessages = function(Mode){
+
window.hotcat_getDefaultsortAliasesAndMessages = function(Mode) {
 
     var meta = [];
 
     var meta = [];
 
     var otherparams = {};
 
     var otherparams = {};
 
     var missingmessages = [];
 
     var missingmessages = [];
 
     var CookieMessages = hotcat_GetCookie("hotcatmessages");
 
     var CookieMessages = hotcat_GetCookie("hotcatmessages");
     if(CookieMessages){
+
     if (CookieMessages) {
 
         CookieMessages = CookieMessages.split("||");
 
         CookieMessages = CookieMessages.split("||");
         for(var Message in hotcat_text_SystemMessage){
+
         for (var Message in hotcat_text_SystemMessage) {
 
             var found = false;
 
             var found = false;
             for(var a=0,l=CookieMessages.length;a<l;a++){
+
             for (var a = 0, l = CookieMessages.length; a < l; a++) {
                 if(CookieMessages[a].indexOf(Message+"::") !== 0) continue;
+
                 if (CookieMessages[a].indexOf(Message + "::") !== 0) continue;
 
                 found = true;
 
                 found = true;
 
                 hotcat_text_SystemMessage[Message] = CookieMessages[a].split("::")[1];
 
                 hotcat_text_SystemMessage[Message] = CookieMessages[a].split("::")[1];
 
             }
 
             }
             if(!found) missingmessages.push(Message);
+
             if (!found) missingmessages.push(Message);
 
         }
 
         }
  
     }else{
+
     } else {
         for(var Message in hotcat_text_SystemMessage){
+
         for (var Message in hotcat_text_SystemMessage) {
 
             missingmessages.push(Message);
 
             missingmessages.push(Message);
 
         }
 
         }
 
     }
 
     }
     if(missingmessages.length > 0){
+
     if (missingmessages.length > 0) {
 
         meta.push("allmessages");
 
         meta.push("allmessages");
 
         otherparams["ammessages"] = missingmessages.join("|");
 
         otherparams["ammessages"] = missingmessages.join("|");
 
     }
 
     }
 
     var CookieDefaultsortAliases = hotcat_GetCookie("hotcatdefaultsortaliases");
 
     var CookieDefaultsortAliases = hotcat_GetCookie("hotcatdefaultsortaliases");
     if(CookieDefaultsortAliases){
+
     if (CookieDefaultsortAliases) {
 
         hotcat_DefaultsortAliases = CookieDefaultsortAliases.split("||");
 
         hotcat_DefaultsortAliases = CookieDefaultsortAliases.split("||");
 
     }
 
     }
     if(hotcat_DefaultsortAliases.length === 0){
+
     if (hotcat_DefaultsortAliases.length === 0) {
 
         meta.push("siteinfo");
 
         meta.push("siteinfo");
 
         otherparams["siprop"] = "magicwords";
 
         otherparams["siprop"] = "magicwords";
 
     }
 
     }
     if(meta.length === 0){
+
     if (meta.length === 0) {
 
         hotcat_getOldPageContent();
 
         hotcat_getOldPageContent();
 
         return;
 
         return;
 
     }
 
     }
 
     var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&meta=' + meta.join("|");
 
     var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&meta=' + meta.join("|");
     for(var paramname in otherparams){
+
     for (var paramname in otherparams) {
 
         URL += "&" + paramname + "=" + otherparams[paramname];
 
         URL += "&" + paramname + "=" + otherparams[paramname];
 
     }
 
     }
     hotcat_ajax.http({url         : URL,
+
     hotcat_ajax.http({
                      onSuccess   : hotcat_receiveDefaultsortAliasesAndMessages,
+
        url: URL,
                      nextcallback : hotcat_getOldPageContent
+
        onSuccess: hotcat_receiveDefaultsortAliasesAndMessages,
 +
        nextcallback: hotcat_getOldPageContent
 
     });
 
     });
 
};
 
};
  
window.hotcat_receiveDefaultsortAliasesAndMessages = function(Req, data){
+
window.hotcat_receiveDefaultsortAliasesAndMessages = function(Req, data) {
 
     var Response = Req.responseXML;
 
     var Response = Req.responseXML;
 
     var MagicWords = Response.getElementsByTagName('magicword');
 
     var MagicWords = Response.getElementsByTagName('magicword');
     if(MagicWords.length > 0){
+
     if (MagicWords.length > 0) {
         for(var a=0;a<MagicWords.length;a++){
+
         for (var a = 0; a < MagicWords.length; a++) {
 
             var MagicWordName = MagicWords[a].getAttribute('name');
 
             var MagicWordName = MagicWords[a].getAttribute('name');
             if(MagicWordName=="defaultsort"){
+
             if (MagicWordName == "defaultsort") {
 
                 var Aliases = MagicWords[a].getElementsByTagName('alias');
 
                 var Aliases = MagicWords[a].getElementsByTagName('alias');
                 for(var b=0;b<Aliases.length;b++){
+
                 for (var b = 0; b < Aliases.length; b++) {
 
                     var ThisAlias = Aliases[b].firstChild.nodeValue;
 
                     var ThisAlias = Aliases[b].firstChild.nodeValue;
 
                     ThisAlias = ThisAlias.replace(/:/g, "");
 
                     ThisAlias = ThisAlias.replace(/:/g, "");
                     if(hotcat_DefaultsortAliases.indexOf(ThisAlias)==-1) hotcat_DefaultsortAliases.push(ThisAlias);
+
                     if (hotcat_DefaultsortAliases.indexOf(ThisAlias) == -1) hotcat_DefaultsortAliases.push(ThisAlias);
 
                 }
 
                 }
 
             }
 
             }
Ligne 450 : Ligne 452 :
 
     }
 
     }
 
     var Messages = Response.getElementsByTagName('message');
 
     var Messages = Response.getElementsByTagName('message');
     if(Messages.length > 0){
+
     if (Messages.length > 0) {
 
         var cookievalue = [];
 
         var cookievalue = [];
         for(var a=0;a<Messages.length;a++){
+
         for (var a = 0; a < Messages.length; a++) {
 
             var MessageName = Messages[a].getAttribute('name');
 
             var MessageName = Messages[a].getAttribute('name');
 
             var MessageContent = (Messages[a].firstChild ? Messages[a].firstChild.nodeValue : "");
 
             var MessageContent = (Messages[a].firstChild ? Messages[a].firstChild.nodeValue : "");
             for(var Message in hotcat_text_SystemMessage){
+
             for (var Message in hotcat_text_SystemMessage) {
                 if(MessageName == Message){
+
                 if (MessageName == Message) {
 
                     hotcat_text_SystemMessage[Message] = MessageContent;
 
                     hotcat_text_SystemMessage[Message] = MessageContent;
                     cookievalue.push(Message+"::"+MessageContent);
+
                     cookievalue.push(Message + "::" + MessageContent);
 
                 }
 
                 }
 
             }
 
             }
Ligne 464 : Ligne 466 :
 
         hotcat_SetCookie("hotcatmessages", cookievalue.join("||"));
 
         hotcat_SetCookie("hotcatmessages", cookievalue.join("||"));
 
     }
 
     }
     if(typeof(data.nextcallback) === "function") data.nextcallback(data);
+
     if (typeof(data.nextcallback) === "function") data.nextcallback(data);
 
};
 
};
  
 
// RÉCUPÉRATION DU CONTENU ACTUEL DE LA PAGE (asynchrone ou synchrone)
 
// RÉCUPÉRATION DU CONTENU ACTUEL DE LA PAGE (asynchrone ou synchrone)
  
window.hotcat_getOldPageContent = function(){
+
window.hotcat_getOldPageContent = function() {
 
     var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=raw&oldid=' + mw.config.get('wgCurRevisionId');
 
     var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=raw&oldid=' + mw.config.get('wgCurRevisionId');
     hotcat_ajax.http({url : URL, onSuccess : hotcat_receiveOldPageContent });
+
     hotcat_ajax.http({
 +
        url: URL,
 +
        onSuccess: hotcat_receiveOldPageContent
 +
    });
 
};
 
};
  
window.hotcat_receiveOldPageContent = function(Req, data){
+
window.hotcat_receiveOldPageContent = function(Req, data) {
 
     hotcat_OldPageContent = Req.responseText;
 
     hotcat_OldPageContent = Req.responseText;
 
     hotcat();
 
     hotcat();
 
};
 
};
  
window.hotcat_gettag = function(){
+
window.hotcat_gettag = function() {
  if(!hotcat_text_HotCatTag || !hotcat_TagGroup) return false;
+
    if (!hotcat_text_HotCatTag || !hotcat_TagGroup) return false;
  var UserGroups = mw.config.get('wgUserGroups');
+
    var UserGroups = mw.config.get('wgUserGroups');
  if(UserGroups === null) UserGroups = ["*"];
+
    if (UserGroups === null) UserGroups = ["*"];
  if(UserGroups.indexOf(hotcat_TagGroup) !== -1) return hotcat_text_HotCatTag;
+
    if (UserGroups.indexOf(hotcat_TagGroup) !== -1) return hotcat_text_HotCatTag;
  return false;
+
    return false;
 
};
 
};
  
Ligne 491 : Ligne 496 :
  
 
window.hotcat = function() {
 
window.hotcat = function() {
     if(hotcat_running!==0) return;
+
     if (hotcat_running !== 0) return;
 
     hotcat_running = 1;
 
     hotcat_running = 1;
 
     var catlinks = document.getElementById("catlinks");
 
     var catlinks = document.getElementById("catlinks");
 
     var hotcatStop = hotcat_getSectionNumber();
 
     var hotcatStop = hotcat_getSectionNumber();
     if(hotcatStop){
+
     if (hotcatStop) {
         if(catlinks) catlinks.parentNode.removeChild(catlinks);
+
         if (catlinks) catlinks.parentNode.removeChild(catlinks);
 
         return;
 
         return;
 
     }
 
     }
     if (! catlinks) {
+
     if (!catlinks) {
         var bodyC = document.getElementById("bodyContent");             // Monobook, Chick, Simple, Mymw.config.get('skin'), Vector
+
         var bodyC = document.getElementById("bodyContent"); // Monobook, Chick, Simple, Mymw.config.get('skin'), Vector
         if(!bodyC) bodyC = document.getElementById("article");         // Cologneblue, Nostalgia, Standard
+
         if (!bodyC) bodyC = document.getElementById("article"); // Cologneblue, Nostalgia, Standard
         if(!bodyC) bodyC = document.getElementById("mw_contentholder"); // Modern
+
         if (!bodyC) bodyC = document.getElementById("mw_contentholder"); // Modern
         if(!bodyC) return;
+
         if (!bodyC) return;
 
         catlinks = document.createElement("div");
 
         catlinks = document.createElement("div");
 
         catlinks.id = "catlinks";
 
         catlinks.id = "catlinks";
 
         catlinks.className = "catlinks";
 
         catlinks.className = "catlinks";
 
         catlinks = bodyC.appendChild(catlinks);
 
         catlinks = bodyC.appendChild(catlinks);
     }else{
+
     } else {
 
         $(catlinks).removeClass("catlinks-allhidden");
 
         $(catlinks).removeClass("catlinks-allhidden");
 
     }
 
     }
     if(typeof(hotcat_LangCustom)=="function") hotcat_LangCustom();
+
     if (typeof(hotcat_LangCustom) == "function") hotcat_LangCustom();
     if(typeof(hotcat_SiteCustom)=="function") hotcat_SiteCustom();
+
     if (typeof(hotcat_SiteCustom) == "function") hotcat_SiteCustom();
     if(typeof(hotcat_UserCustom)=="function") hotcat_UserCustom();
+
     if (typeof(hotcat_UserCustom) == "function") hotcat_UserCustom();
     if(mw.config.get('wgAction')=="edit") hotcat_list_down = true;
+
     if (mw.config.get('wgAction') == "edit") hotcat_list_down = true;
     var catline = document.getElementById ('mw-normal-catlinks');
+
     var catline = document.getElementById('mw-normal-catlinks');
     if ( !catline || catline === null || typeof catline == 'undefined' ){
+
     if (!catline || catline === null || typeof catline == 'undefined') {
 
         catline = catlinks.insertBefore(document.createElement("div"), catlinks.firstChild);
 
         catline = catlinks.insertBefore(document.createElement("div"), catlinks.firstChild);
 
         catline.id = "mw-normal-catlinks";
 
         catline.id = "mw-normal-catlinks";
Ligne 524 : Ligne 529 :
 
     hotcat_append_add_span(catline);
 
     hotcat_append_add_span(catline);
 
     hotcat_append_multiedit_span(catline);
 
     hotcat_append_multiedit_span(catline);
     if(hotcat_Multi_IsEditPage){
+
     if (hotcat_Multi_IsEditPage) {
 
         var CatLine = document.getElementById("catlinks");
 
         var CatLine = document.getElementById("catlinks");
 
         var PreviewWindow = document.getElementById("wikiPreview");
 
         var PreviewWindow = document.getElementById("wikiPreview");
         if((CatLine)&&(PreviewWindow)){
+
         if ((CatLine) && (PreviewWindow)) {
 
             CatLine.parentNode.removeChild(CatLine);
 
             CatLine.parentNode.removeChild(CatLine);
 
             PreviewWindow.parentNode.insertBefore(CatLine, PreviewWindow.nextSibling);
 
             PreviewWindow.parentNode.insertBefore(CatLine, PreviewWindow.nextSibling);
Ligne 537 : Ligne 542 :
 
// DÉTERMINATION DE LA SECTION ÉDITÉE  (si section et section != dernière ou section == new : arrêt hotCats)
 
// DÉTERMINATION DE LA SECTION ÉDITÉE  (si section et section != dernière ou section == new : arrêt hotCats)
  
window.hotcat_getSectionNumber = function(){
+
window.hotcat_getSectionNumber = function() {
     if(!hotcat_Multi_IsEditPage) return false;
+
     if (!hotcat_Multi_IsEditPage) return false;
 
     var SectionNumber = document.editform.wpSection.value;
 
     var SectionNumber = document.editform.wpSection.value;
     if(SectionNumber==="") return false;
+
     if (SectionNumber === "") return false;
 
     hotcat_Multi_IsSection = SectionNumber;
 
     hotcat_Multi_IsSection = SectionNumber;
     if(SectionNumber==="new") return true;
+
     if (SectionNumber === "new") return true;
 
     SectionNumber = parseInt(SectionNumber);
 
     SectionNumber = parseInt(SectionNumber);
 
     hotcat_Multi_IsSection = SectionNumber;
 
     hotcat_Multi_IsSection = SectionNumber;
 
     var SectionRegExp = new RegExp("[^=\\|\\{\n]*={1,6}[^=\n]+={1,6}\n", "ig");
 
     var SectionRegExp = new RegExp("[^=\\|\\{\n]*={1,6}[^=\n]+={1,6}\n", "ig");
 
     var Sections = hotcat_OldPageContent.match(SectionRegExp);
 
     var Sections = hotcat_OldPageContent.match(SectionRegExp);
     if(Sections===null) return false;
+
     if (Sections === null) return false;
     if(Sections.length === SectionNumber) return false;
+
     if (Sections.length === SectionNumber) return false;
 
     return true;
 
     return true;
 
};
 
};
Ligne 554 : Ligne 559 :
 
// CRÉATION DU LIEN "CATÉGORIES"
 
// CRÉATION DU LIEN "CATÉGORIES"
  
window.hotcat_append_firstlink = function( catline, plural) {
+
window.hotcat_append_firstlink = function(catline, plural) {
     if(!hotcat_text_SystemMessage.pagecategorieslink||!hotcat_text_SystemMessage.categories||!hotcat_text_SystemMessage.pagecategories){
+
     if (!hotcat_text_SystemMessage.pagecategorieslink || !hotcat_text_SystemMessage.categories || !hotcat_text_SystemMessage.pagecategories) {
 
         hotcat_GetMessages(false);
 
         hotcat_GetMessages(false);
 
     }
 
     }
     if (!catline.firstChild ){
+
     if (!catline.firstChild) {
 
         var a = document.createElement('a');
 
         var a = document.createElement('a');
         a.href = mw.config.get('wgServer')+mw.config.get('wgArticlePath').split('$1').join(hotcat_text_SystemMessage.pagecategorieslink);
+
         a.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_text_SystemMessage.pagecategorieslink);
 
         a.title = hotcat_text_SystemMessage.categories;
 
         a.title = hotcat_text_SystemMessage.categories;
 
         a.appendChild(document.createTextNode(hotcat_PLURAL(hotcat_text_SystemMessage.pagecategories, plural)));
 
         a.appendChild(document.createTextNode(hotcat_PLURAL(hotcat_text_SystemMessage.pagecategories, plural)));
 
         catline.appendChild(a);
 
         catline.appendChild(a);
 
         catline.appendChild(document.createTextNode(' : '));
 
         catline.appendChild(document.createTextNode(' : '));
     }else{
+
     } else {
 
         catline.firstChild.title = hotcat_text_SystemMessage.categories;
 
         catline.firstChild.title = hotcat_text_SystemMessage.categories;
 
     }
 
     }
Ligne 574 : Ligne 579 :
 
window.hotcat_modify_existing = function(catline) {
 
window.hotcat_modify_existing = function(catline) {
 
     var ul = catline.getElementsByTagName("ul")[0];
 
     var ul = catline.getElementsByTagName("ul")[0];
     if(!ul){ // ( Mediawiki < 1.18 )
+
     if (!ul) { // ( Mediawiki < 1.18 )
 
         var spans = catline.getElementsByTagName("span");
 
         var spans = catline.getElementsByTagName("span");
         for(var i=0,l=spans.length;i<l;i++){
+
         for (var i = 0, l = spans.length; i < l; i++) {
             hotcat_modify_span ( spans[i], i ) ;
+
             hotcat_modify_span(spans[i], i);
 
         }
 
         }
 
         return;
 
         return;
 
     }
 
     }
 
     var lis = ul.getElementsByTagName("li");
 
     var lis = ul.getElementsByTagName("li");
     for(var i=0,l=lis.length;i<l;i++){
+
     for (var i = 0, l = lis.length; i < l; i++) {
 
         var li = lis[i];
 
         var li = lis[i];
 
         var cat_link = li.getElementsByTagName('a')[0];
 
         var cat_link = li.getElementsByTagName('a')[0];
Ligne 588 : Ligne 593 :
 
         li.appendChild(span);
 
         li.appendChild(span);
 
         span.appendChild(cat_link);
 
         span.appendChild(cat_link);
         hotcat_modify_span ( span, i ) ;
+
         hotcat_modify_span(span, i);
 
     }
 
     }
 
};
 
};
Ligne 594 : Ligne 599 :
 
// AJOUT DES LIENS (–) ET (±)
 
// AJOUT DES LIENS (–) ET (±)
  
window.hotcat_modify_span = function( span, i ) {
+
window.hotcat_modify_span = function(span, i) {
     if(!hotcat_text_SystemMessage["red-link-title"]) hotcat_GetMessages(false);
+
     if (!hotcat_text_SystemMessage["red-link-title"]) hotcat_GetMessages(false);
 
     var cat_link = span.getElementsByTagName('a')[0];
 
     var cat_link = span.getElementsByTagName('a')[0];
     if(!cat_link) return;
+
     if (!cat_link) return;
     cat_link.id = "CatLink_"+i;
+
     cat_link.id = "CatLink_" + i;
 
     var cat_title = cat_link.title;
 
     var cat_title = cat_link.title;
     if(!cat_title) return;
+
     if (!cat_title) return;
 
     cat_title = cat_title.split(hotcat_CatNamespace).join('');
 
     cat_title = cat_title.split(hotcat_CatNamespace).join('');
 
     cat_title = cat_title.replace(hotcat_text_SystemMessage["red-link-title"].split('$1').join(''), "");
 
     cat_title = cat_title.replace(hotcat_text_SystemMessage["red-link-title"].split('$1').join(''), "");
     var sep1 = document.createTextNode ( " " ) ;
+
     var sep1 = document.createTextNode(" ");
     span.id = "hotcat_Span_" + i ;
+
     span.id = "hotcat_Span_" + i;
     var a1 = document.createTextNode ( "(–)" ) ;
+
     var a1 = document.createTextNode("(–)");
     var remove_link = document.createElement ( "a" ) ;
+
     var remove_link = document.createElement("a");
     var remove_id = "hotcat_remove_" + i ;
+
     var remove_id = "hotcat_remove_" + i;
 
     remove_link.id = remove_id;
 
     remove_link.id = remove_id;
     remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\","+i+");" ;
+
     remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\"," + i + ");";
 
     remove_link.title = hotcat_text_RemoveLinkTitle.split("$1").join(cat_title);
 
     remove_link.title = hotcat_text_RemoveLinkTitle.split("$1").join(cat_title);
     remove_link.appendChild ( a1 ) ;
+
     remove_link.appendChild(a1);
     span.appendChild ( sep1 ) ;
+
     span.appendChild(sep1);
     span.appendChild ( remove_link ) ;
+
     span.appendChild(remove_link);
     var mod_id = "hotcat_modify_" + i ;
+
     var mod_id = "hotcat_modify_" + i;
     var sep2 = document.createTextNode ( " " ) ;
+
     var sep2 = document.createTextNode(" ");
     var a2 = document.createTextNode ( "(±)" ) ;
+
     var a2 = document.createTextNode("(±)");
     var modify_link = document.createElement ( "a" ) ;
+
     var modify_link = document.createElement("a");
     modify_link.id = mod_id ;
+
     modify_link.id = mod_id;
     modify_link.href = "javascript:hotcat_modify(\""+cat_title+"\"," + i + ");" ;
+
     modify_link.href = "javascript:hotcat_modify(\"" + cat_title + "\"," + i + ");";
 
     modify_link.title = hotcat_text_ModifyLinkTitle.split("$1").join(cat_title);
 
     modify_link.title = hotcat_text_ModifyLinkTitle.split("$1").join(cat_title);
     modify_link.appendChild ( a2 ) ;
+
     modify_link.appendChild(a2);
     span.appendChild ( sep2 ) ;
+
     span.appendChild(sep2);
     span.appendChild ( modify_link ) ;
+
     span.appendChild(modify_link);
 
     hotcat_SpanMatrix[i] = span;
 
     hotcat_SpanMatrix[i] = span;
 
     hotcat_CatLinkMatrix[i] = cat_link;
 
     hotcat_CatLinkMatrix[i] = cat_link;
Ligne 637 : Ligne 642 :
 
     var Spans = catline.getElementsByTagName('span');
 
     var Spans = catline.getElementsByTagName('span');
 
     var span_add = document.createElement('span');
 
     var span_add = document.createElement('span');
     var a_add = document.createElement ( "a" ) ;
+
     var a_add = document.createElement("a");
     var a_text = document.createTextNode ( hotcat_text_AddLinkText ) ;
+
     var a_text = document.createTextNode(hotcat_text_AddLinkText);
     span_add.id = "hotcat_add" ;
+
     span_add.id = "hotcat_add";
     a_add.id = "hotcat_addlink" ;
+
     a_add.id = "hotcat_addlink";
     a_add.href = "javascript:hotcat_add_new("+hotcat_Form_Index+")" ;
+
     a_add.href = "javascript:hotcat_add_new(" + hotcat_Form_Index + ")";
     a_add.title = hotcat_text_AddLinkTitle ;
+
     a_add.title = hotcat_text_AddLinkTitle;
     a_add.appendChild( a_text ) ;
+
     a_add.appendChild(a_text);
     span_add.appendChild( a_add ) ;
+
     span_add.appendChild(a_add);
     if(Spans[0]) catline.appendChild(document.createTextNode(' | '));
+
     if (Spans[0]) catline.appendChild(document.createTextNode(' | '));
 
     catline.appendChild(span_add);
 
     catline.appendChild(span_add);
 
     hotcat_SpanMatrix[hotcat_Form_Index] = span_add;
 
     hotcat_SpanMatrix[hotcat_Form_Index] = span_add;
Ligne 655 : Ligne 660 :
 
// FONCTION DE RETRAIT D'UNE CATÉGORIE
 
// FONCTION DE RETRAIT D'UNE CATÉGORIE
  
window.hotcat_remove = function( cat_title, Index ) {
+
window.hotcat_remove = function(cat_title, Index) {
     if(!hotcat_Multi_Edit){
+
     if (!hotcat_Multi_Edit) {
 
         var RemovedCategories = [];
 
         var RemovedCategories = [];
 
         var ModifiedCategories_from = [];
 
         var ModifiedCategories_from = [];
Ligne 662 : Ligne 667 :
 
         var AddedCategories = [];
 
         var AddedCategories = [];
 
         RemovedCategories.push(cat_title);
 
         RemovedCategories.push(cat_title);
         if (hotcat_SkipConfirm || confirm(hotcat_text_RemoveConfirm.split("$1").join(cat_title))){
+
         if (hotcat_SkipConfirm || confirm(hotcat_text_RemoveConfirm.split("$1").join(cat_title))) {
 
             hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, hotcat_OldDefaultSort);
 
             hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, hotcat_OldDefaultSort);
 
         }
 
         }
     }else{
+
     } else {
 
         var Span = hotcat_SpanMatrix[Index];
 
         var Span = hotcat_SpanMatrix[Index];
         if($(Span).hasClass("AddedCatSpan")){
+
         if ($(Span).hasClass("AddedCatSpan")) {
 
             Span.parentNode.removeChild(Span);
 
             Span.parentNode.removeChild(Span);
         }else{
+
         } else {
 
             var FirstLink = hotcat_CatLinkMatrix[Index];
 
             var FirstLink = hotcat_CatLinkMatrix[Index];
 
             var OldCat = hotcat_CatNameMatrix[Index];
 
             var OldCat = hotcat_CatNameMatrix[Index];
 
             FirstLink.innerHTML = OldCat;
 
             FirstLink.innerHTML = OldCat;
             FirstLink.title = hotcat_CatNamespace+OldCat;
+
             FirstLink.title = hotcat_CatNamespace + OldCat;
             FirstLink.href = mw.config.get('wgServer')+mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace+OldCat);
+
             FirstLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + OldCat);
 
             $(FirstLink).addClass('RemovedCategory');
 
             $(FirstLink).addClass('RemovedCategory');
 
             $(FirstLink).removeClass("ModifiedCategory");
 
             $(FirstLink).removeClass("ModifiedCategory");
             if(hotcat_CatLinkIsRedMatrix[Index]){
+
             if (hotcat_CatLinkIsRedMatrix[Index]) {
                 if(!$(FirstLink).hasClass("new")) $(FirstLink).addClass("new");
+
                 if (!$(FirstLink).hasClass("new")) $(FirstLink).addClass("new");
             }else{
+
             } else {
 
                 $(FirstLink).removeClass("new");
 
                 $(FirstLink).removeClass("new");
 
             }
 
             }
Ligne 689 : Ligne 694 :
 
// MODIFICATION D'UNE CATÉGORIE
 
// MODIFICATION D'UNE CATÉGORIE
  
window.hotcat_modify = function( catname, Index ) {
+
window.hotcat_modify = function(catname, Index) {
     var link = hotcat_CatLinkMatrix[Index] ;
+
     var link = hotcat_CatLinkMatrix[Index];
     var span = hotcat_SpanMatrix[Index] ;
+
     var span = hotcat_SpanMatrix[Index];
 
     var Links = span.getElementsByTagName('a');
 
     var Links = span.getElementsByTagName('a');
     for(a=0;a<Links.length;a++){
+
     for (a = 0; a < Links.length; a++) {
        Links[a].style.display = "none";
+
        Links[a].style.display = "none";
 
     }
 
     }
     span.firstChild.style.display = "none" ;
+
     span.firstChild.style.display = "none";
     hotcat_create_new_span ( span , catname, Index ) ;
+
     hotcat_create_new_span(span, catname, Index);
 
     hotcat_text_changed(Index);
 
     hotcat_text_changed(Index);
 
};
 
};
Ligne 703 : Ligne 708 :
 
// AJOUT D'UNE CATÉGORIE
 
// AJOUT D'UNE CATÉGORIE
  
window.hotcat_add_new = function(Index) {
+
window.hotcat_add_new = function(Index) {
     var span_add = document.getElementById( "hotcat_add" ) ;
+
     var span_add = document.getElementById("hotcat_add");
 
     span_add.getElementsByTagName('a')[0].style.display = "none";
 
     span_add.getElementsByTagName('a')[0].style.display = "none";
     hotcat_create_new_span ( span_add , "", Index ) ;
+
     hotcat_create_new_span(span_add, "", Index);
 
};
 
};
  
 
// CRÉATION DU FORMULAIRE DE MODIFICATION OU D'AJOUT D'UNE CATÉGORIE
 
// CRÉATION DU FORMULAIRE DE MODIFICATION OU D'AJOUT D'UNE CATÉGORIE
  
window.hotcat_create_new_span = function( thespan , init_text, Index ) {
+
window.hotcat_create_new_span = function(thespan, init_text, Index) {
 
     var DefaultSort = hotcat_defaultSort_getOneOld(init_text);
 
     var DefaultSort = hotcat_defaultSort_getOneOld(init_text);
     if($(thespan).hasClass("AddedCatSpan" )) DefaultSort = hotcat_SortMatrix[Index];
+
     if ($(thespan).hasClass("AddedCatSpan")) DefaultSort = hotcat_SortMatrix[Index];
 
     hotcat_CatNameMatrix[Index] = init_text;
 
     hotcat_CatNameMatrix[Index] = init_text;
     var form = document.createElement ( "form" ) ;
+
     var form = document.createElement("form");
 
     form.id = "hotcat_form" + Index;
 
     form.id = "hotcat_form" + Index;
     form.method = "post" ;
+
     form.method = "post";
     form.onsubmit = function () {
+
     form.onsubmit = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
 
         hotcat_ok(FormIndex);
 
         hotcat_ok(FormIndex);
 
         return false;
 
         return false;
     } ;
+
     };
     form.style.display = "inline" ;
+
     form.style.display = "inline";
     var text = document.createElement ( "input" ) ;
+
     var text = document.createElement("input");
     text.size = 40 ;
+
     text.size = 40;
     text.id = "hotcat_text" + Index ;
+
     text.id = "hotcat_text" + Index;
     text.type = "text" ;
+
     text.type = "text";
     text.value = init_text + DefaultSort ;
+
     text.value = init_text + DefaultSort;
     text.onkeyup = function () {
+
     text.onkeyup = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
         window.setTimeout("hotcat_text_changed("+FormIndex+");", hotcat_suggestion_delay );
+
         window.setTimeout("hotcat_text_changed(" + FormIndex + ");", hotcat_suggestion_delay);
     } ;
+
     };
     var list = document.createElement ( "select" ) ;
+
     var list = document.createElement("select");
     list.id = "hotcat_list" + Index ;
+
     list.id = "hotcat_list" + Index;
     list.style.display = "none" ;
+
     list.style.display = "none";
     list.onclick = function () {
+
     list.onclick = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
 
         hotcat_text_replace(FormIndex);
 
         hotcat_text_replace(FormIndex);
     } ;
+
     };
     var exists = document.createElement ( "img" ) ;
+
     var exists = document.createElement("img");
     exists.id = "hotcat_exists" + Index ;
+
     exists.id = "hotcat_exists" + Index;
     exists.height = hotcat_exists_size ;
+
     exists.height = hotcat_exists_size;
     exists.width = hotcat_exists_size ;
+
     exists.width = hotcat_exists_size;
 
     exists.title = hotcat_text_Exists_NoTitle;
 
     exists.title = hotcat_text_Exists_NoTitle;
     exists.src = hotcat_exists_no ;
+
     exists.src = hotcat_exists_no;
     var ParentCats = document.createElement ( "input" ) ;
+
     var ParentCats = document.createElement("input");
     ParentCats.id = "hotcat_parents" + Index ;
+
     ParentCats.id = "hotcat_parents" + Index;
     ParentCats.type = "button" ;
+
     ParentCats.type = "button";
     ParentCats.value = hotcat_text_ParentText ;
+
     ParentCats.value = hotcat_text_ParentText;
     ParentCats.title = hotcat_text_ParentTitle ;
+
     ParentCats.title = hotcat_text_ParentTitle;
     ParentCats.onclick = function(){
+
     ParentCats.onclick = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
 
         hotcat_text_changed(FormIndex, "UP");
 
         hotcat_text_changed(FormIndex, "UP");
 
     };
 
     };
     var DaughterCats = document.createElement ( "input" ) ;
+
     var DaughterCats = document.createElement("input");
     DaughterCats.id = "hotcat_daughters" + Index ;
+
     DaughterCats.id = "hotcat_daughters" + Index;
     DaughterCats.type = "button" ;
+
     DaughterCats.type = "button";
     DaughterCats.value = hotcat_text_DaughterText ;
+
     DaughterCats.value = hotcat_text_DaughterText;
     DaughterCats.title = hotcat_text_DaughterTitle ;
+
     DaughterCats.title = hotcat_text_DaughterTitle;
     DaughterCats.onclick = function(){
+
     DaughterCats.onclick = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
 
         hotcat_text_changed(FormIndex, "DOWN");
 
         hotcat_text_changed(FormIndex, "DOWN");
 
     };
 
     };
     var OK = document.createElement ( "input" ) ;
+
     var OK = document.createElement("input");
     OK.id = "hotcat_OK" + Index ;
+
     OK.id = "hotcat_OK" + Index;
     OK.type = "button" ;
+
     OK.type = "button";
     OK.value = hotcat_text_InputOK ;
+
     OK.value = hotcat_text_InputOK;
     OK.onclick = function(){
+
     OK.onclick = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
         hotcat_ok(FormIndex) ;
+
         hotcat_ok(FormIndex);
 
     };
 
     };
     var cancel = document.createElement ( "input" ) ;
+
     var cancel = document.createElement("input");
     cancel.id = "hotcat_cancel" + Index ;
+
     cancel.id = "hotcat_cancel" + Index;
     cancel.type = "button" ;
+
     cancel.type = "button";
     cancel.value = hotcat_text_InputCancel ;
+
     cancel.value = hotcat_text_InputCancel;
     cancel.onclick = function(){
+
     cancel.onclick = function() {
 
         var FormIndex = hotcat_getIndex(this);
 
         var FormIndex = hotcat_getIndex(this);
         hotcat_cancel(FormIndex) ;
+
         hotcat_cancel(FormIndex);
 
     };
 
     };
     form.appendChild ( text ) ;
+
     form.appendChild(text);
     form.appendChild ( list ) ;
+
     form.appendChild(list);
     form.appendChild ( exists ) ;
+
     form.appendChild(exists);
     if ( hotcat_ParentButton ) {
+
     if (hotcat_ParentButton) {
         form.appendChild ( ParentCats ) ;
+
         form.appendChild(ParentCats);
 
     }
 
     }
     if ( hotcat_DaughterButton ) {
+
     if (hotcat_DaughterButton) {
         form.appendChild ( DaughterCats ) ;
+
         form.appendChild(DaughterCats);
 
     }
 
     }
     form.appendChild ( OK ) ;
+
     form.appendChild(OK);
     form.appendChild ( cancel ) ;
+
     form.appendChild(cancel);
     thespan.appendChild ( form ) ;
+
     thespan.appendChild(form);
     text.focus () ;
+
     text.focus();
 
     hotcat_upDate_FormPositions();
 
     hotcat_upDate_FormPositions();
 
     hotcat_FormMatrix[Index] = form;
 
     hotcat_FormMatrix[Index] = form;
Ligne 805 : Ligne 810 :
 
     var Form = hotcat_FormMatrix[Index];
 
     var Form = hotcat_FormMatrix[Index];
 
     var Input = hotcat_TextMatrix[Index];
 
     var Input = hotcat_TextMatrix[Index];
     var TheSpan = hotcat_SpanMatrix[Index] ;
+
     var TheSpan = hotcat_SpanMatrix[Index];
 
     var CatLink = hotcat_CatLinkMatrix[Index];
 
     var CatLink = hotcat_CatLinkMatrix[Index];
 
     var IfExist = hotcat_ExistMatrix[Index];
 
     var IfExist = hotcat_ExistMatrix[Index];
 
     var OldCatName = hotcat_CatNameMatrix[Index];
 
     var OldCatName = hotcat_CatNameMatrix[Index];
 
     var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
 
     var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
     var NewCatName = Input.value.ucFirst().replace(/\|.*/, "") ;
+
     var NewCatName = Input.value.ucFirst().replace(/\|.*/, "");
 
     var NewDefaultSort = Input.value.ucFirst().split(NewCatName).join("");
 
     var NewDefaultSort = Input.value.ucFirst().split(NewCatName).join("");
 
     hotcat_SortMatrix[Index] = NewDefaultSort;
 
     hotcat_SortMatrix[Index] = NewDefaultSort;
     if ( NewCatName == "" ) {
+
     if (NewCatName == "") {
         hotcat_cancel(Index) ;
+
         hotcat_cancel(Index);
         return ;
+
         return;
 
     }
 
     }
     if(hotcat_Multi_Edit==false){
+
     if (hotcat_Multi_Edit == false) {
         if((OldCatName+OldDefaultSort)==(NewCatName+NewDefaultSort)) return;
+
         if ((OldCatName + OldDefaultSort) == (NewCatName + NewDefaultSort)) return;
 
         var RemovedCategories = [];
 
         var RemovedCategories = [];
 
         var ModifiedCategories_from = [];
 
         var ModifiedCategories_from = [];
 
         var ModifiedCategories_to = [];
 
         var ModifiedCategories_to = [];
 
         var AddedCategories = [];
 
         var AddedCategories = [];
         if ( TheSpan.id != "hotcat_add" ) {
+
         if (TheSpan.id != "hotcat_add") {
             ModifiedCategories_from.push(OldCatName+OldDefaultSort);
+
             ModifiedCategories_from.push(OldCatName + OldDefaultSort);
             ModifiedCategories_to.push(NewCatName+NewDefaultSort);
+
             ModifiedCategories_to.push(NewCatName + NewDefaultSort);
         }else{
+
         } else {
             AddedCategories.push(NewCatName+NewDefaultSort);
+
             AddedCategories.push(NewCatName + NewDefaultSort);
 
         }
 
         }
 
         hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, hotcat_OldDefaultSort);
 
         hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, hotcat_OldDefaultSort);
     }else{
+
     } else {
 
         var Exist = (IfExist.title == hotcat_text_Exists_YesTitle);
 
         var Exist = (IfExist.title == hotcat_text_Exists_YesTitle);
         if(TheSpan.id!="hotcat_add"){
+
         if (TheSpan.id != "hotcat_add") {
 
             CatLink.innerHTML = NewCatName;
 
             CatLink.innerHTML = NewCatName;
             CatLink.title = hotcat_CatNamespace+NewCatName;
+
             CatLink.title = hotcat_CatNamespace + NewCatName;
             CatLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace+NewCatName);
+
             CatLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + NewCatName);
             if((!$(CatLink).hasClass("AddedCategory"))&&(!$(CatLink).hasClass("ModifiedCategory"))) $(CatLink).addClass("ModifiedCategory");
+
             if ((!$(CatLink).hasClass("AddedCategory")) && (!$(CatLink).hasClass("ModifiedCategory"))) $(CatLink).addClass("ModifiedCategory");
             if((OldCatName+OldDefaultSort)==(NewCatName+NewDefaultSort)){
+
             if ((OldCatName + OldDefaultSort) == (NewCatName + NewDefaultSort)) {
 
                 $(CatLink).removeClass("ModifiedCategory");
 
                 $(CatLink).removeClass("ModifiedCategory");
 
             }
 
             }
 
             $(CatLink).removeClass("RemovedCategory");
 
             $(CatLink).removeClass("RemovedCategory");
         }else{
+
         } else {
 
             hotcat_NewCatsIndex++
 
             hotcat_NewCatsIndex++
 
             hotcat_CatNameMatrix[hotcat_NewCatsIndex] = NewCatName;
 
             hotcat_CatNameMatrix[hotcat_NewCatsIndex] = NewCatName;
 
             hotcat_SortMatrix[hotcat_NewCatsIndex] = NewDefaultSort;
 
             hotcat_SortMatrix[hotcat_NewCatsIndex] = NewDefaultSort;
 
             var NewSpan = document.createElement('span');
 
             var NewSpan = document.createElement('span');
             NewSpan.id = "hotcat_Span_"+hotcat_NewCatsIndex;
+
             NewSpan.id = "hotcat_Span_" + hotcat_NewCatsIndex;
 
             NewSpan.className = "AddedCatSpan";
 
             NewSpan.className = "AddedCatSpan";
 
             CatLink = document.createElement('a');
 
             CatLink = document.createElement('a');
             CatLink.id = "CatLink_"+hotcat_NewCatsIndex;
+
             CatLink.id = "CatLink_" + hotcat_NewCatsIndex;
 
             CatLink.innerHTML = NewCatName;
 
             CatLink.innerHTML = NewCatName;
             CatLink.title = hotcat_CatNamespace+NewCatName;
+
             CatLink.title = hotcat_CatNamespace + NewCatName;
             CatLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace+NewCatName);
+
             CatLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + NewCatName);
 
             $(CatLink).addClass("AddedCategory");
 
             $(CatLink).addClass("AddedCategory");
 
             var RemoveLink = document.createElement('a');
 
             var RemoveLink = document.createElement('a');
 
             RemoveLink.innerHTML = hotcat_text_RemoveLinkText;
 
             RemoveLink.innerHTML = hotcat_text_RemoveLinkText;
             RemoveLink.id = "hotcat_remove_"+hotcat_NewCatsIndex;
+
             RemoveLink.id = "hotcat_remove_" + hotcat_NewCatsIndex;
 
             RemoveLink.title = hotcat_text_RemoveLinkTitle.split("$1").join(NewCatName);
 
             RemoveLink.title = hotcat_text_RemoveLinkTitle.split("$1").join(NewCatName);
             RemoveLink.href = "javascript:hotcat_remove(\"" + NewCatName+ "\","+hotcat_NewCatsIndex+");";
+
             RemoveLink.href = "javascript:hotcat_remove(\"" + NewCatName + "\"," + hotcat_NewCatsIndex + ");";
 
             var ModifyLink = document.createElement('a');
 
             var ModifyLink = document.createElement('a');
 
             ModifyLink.innerHTML = hotcat_text_ModifyLinkText;
 
             ModifyLink.innerHTML = hotcat_text_ModifyLinkText;
             ModifyLink.id = "hotcat_modify_"+hotcat_NewCatsIndex;
+
             ModifyLink.id = "hotcat_modify_" + hotcat_NewCatsIndex;
 
             ModifyLink.title = hotcat_text_ModifyLinkTitle.split("$1").join(NewCatName);
 
             ModifyLink.title = hotcat_text_ModifyLinkTitle.split("$1").join(NewCatName);
             ModifyLink.href = "javascript:hotcat_modify(\""+NewCatName+"\","+hotcat_NewCatsIndex+ ")";
+
             ModifyLink.href = "javascript:hotcat_modify(\"" + NewCatName + "\"," + hotcat_NewCatsIndex + ")";
 
             NewSpan.appendChild(CatLink);
 
             NewSpan.appendChild(CatLink);
 
             NewSpan.appendChild(document.createTextNode(" "));
 
             NewSpan.appendChild(document.createTextNode(" "));
Ligne 876 : Ligne 881 :
 
             hotcat_ModifyLinkMatrix.push[hotcat_NewCatsIndex] = ModifyLink;
 
             hotcat_ModifyLinkMatrix.push[hotcat_NewCatsIndex] = ModifyLink;
 
         }
 
         }
         if(!Exist){
+
         if (!Exist) {
 
             $(CatLink).addClass("new");
 
             $(CatLink).addClass("new");
         }else{
+
         } else {
 
             $(CatLink).removeClass("new");
 
             $(CatLink).removeClass("new");
 
         }
 
         }
 
         var Links = TheSpan.getElementsByTagName('a');
 
         var Links = TheSpan.getElementsByTagName('a');
         for(var a=0;a<Links.length;a++){
+
         for (var a = 0; a < Links.length; a++) {
 
             Links[a].style.display = "";
 
             Links[a].style.display = "";
 
         }
 
         }
Ligne 888 : Ligne 893 :
 
         hotcat_Multi_CheckForChanges();
 
         hotcat_Multi_CheckForChanges();
 
         hotcat_upDate_FormPositions();
 
         hotcat_upDate_FormPositions();
         if(TheSpan.id!="hotcat_add"){
+
         if (TheSpan.id != "hotcat_add") {
             document.getElementById("hotcat_modify_"+Index).focus();
+
             document.getElementById("hotcat_modify_" + Index).focus();
         }else{
+
         } else {
 
             document.getElementById("hotcat_addlink").focus();
 
             document.getElementById("hotcat_addlink").focus();
 
         }
 
         }
Ligne 898 : Ligne 903 :
 
// ANNULATION DU FORMULAIRE
 
// ANNULATION DU FORMULAIRE
  
window.hotcat_cancel = function(Index) {
+
window.hotcat_cancel = function(Index) {
 
     var Form = hotcat_FormMatrix[Index];
 
     var Form = hotcat_FormMatrix[Index];
 
     var Input = hotcat_TextMatrix[Index];
 
     var Input = hotcat_TextMatrix[Index];
     var TheSpan = hotcat_SpanMatrix[Index] ;
+
     var TheSpan = hotcat_SpanMatrix[Index];
 
     var CatLink = hotcat_CatLinkMatrix[Index];
 
     var CatLink = hotcat_CatLinkMatrix[Index];
 
     var IfExist = hotcat_ExistMatrix[Index];
 
     var IfExist = hotcat_ExistMatrix[Index];
 
     var OldCatLink = hotcat_RemoveLinkMatrix[Index];
 
     var OldCatLink = hotcat_RemoveLinkMatrix[Index];
     TheSpan.removeChild ( Form ) ;
+
     TheSpan.removeChild(Form);
 
     var Links = TheSpan.getElementsByTagName('a');
 
     var Links = TheSpan.getElementsByTagName('a');
     for(a=0;a<Links.length;a++){
+
     for (a = 0; a < Links.length; a++) {
 
         Links[a].style.display = "";
 
         Links[a].style.display = "";
 
     }
 
     }
     TheSpan.firstChild.style.display = "" ;
+
     TheSpan.firstChild.style.display = "";
 
     hotcat_Multi_CheckForChanges();
 
     hotcat_Multi_CheckForChanges();
 
     hotcat_upDate_FormPositions();
 
     hotcat_upDate_FormPositions();
     if(TheSpan.id!="hotcat_add"){
+
     if (TheSpan.id != "hotcat_add") {
         document.getElementById("hotcat_modify_"+Index).focus();
+
         document.getElementById("hotcat_modify_" + Index).focus();
     }else{
+
     } else {
 
         document.getElementById("hotcat_addlink").focus();
 
         document.getElementById("hotcat_addlink").focus();
 
     }
 
     }
Ligne 924 : Ligne 929 :
 
// AJOUT DU LIEN (±)
 
// AJOUT DU LIEN (±)
  
window.hotcat_append_multiedit_span = function( CatLine ){
+
window.hotcat_append_multiedit_span = function(CatLine) {
 
     var FirstLink = CatLine.getElementsByTagName('a')[0];
 
     var FirstLink = CatLine.getElementsByTagName('a')[0];
 
     var Span = document.createElement('span');
 
     var Span = document.createElement('span');
     Span.id ='hotcat_modify_multi_span';
+
     Span.id = 'hotcat_modify_multi_span';
 
     var Link = document.createElement('a');
 
     var Link = document.createElement('a');
 
     Link.id = "hotcat_modify_multi_Link";
 
     Link.id = "hotcat_modify_multi_Link";
Ligne 937 : Ligne 942 :
 
     FirstLink.parentNode.insertBefore(document.createTextNode(" "), FirstLink.nextSibling);
 
     FirstLink.parentNode.insertBefore(document.createTextNode(" "), FirstLink.nextSibling);
 
     var DefaultSortSpan = document.createElement('span');
 
     var DefaultSortSpan = document.createElement('span');
     DefaultSortSpan.id ='hotcat_DefaultSort_span';
+
     DefaultSortSpan.id = 'hotcat_DefaultSort_span';
 
     var DefaultSortLink = document.createElement('a');
 
     var DefaultSortLink = document.createElement('a');
 
     DefaultSortLink.id = "hotcat_DefaultSort_Link";
 
     DefaultSortLink.id = "hotcat_DefaultSort_Link";
Ligne 950 : Ligne 955 :
 
     Span.parentNode.insertBefore(DefaultSortSpan, Span.nextSibling);
 
     Span.parentNode.insertBefore(DefaultSortSpan, Span.nextSibling);
 
     Span.parentNode.insertBefore(document.createTextNode(" "), Span.nextSibling);
 
     Span.parentNode.insertBefore(document.createTextNode(" "), Span.nextSibling);
     if(hotcat_AutoMulti) hotcat_multiedit_createForm();
+
     if (hotcat_AutoMulti) hotcat_multiedit_createForm();
 
};
 
};
  
 
// CREATION DU FORMULAIRE "MULTI"
 
// CREATION DU FORMULAIRE "MULTI"
  
window.hotcat_multiedit_createForm = function(){
+
window.hotcat_multiedit_createForm = function() {
 
     var OldForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
 
     var OldForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
     while(OldForms[0]) OldForms[0].parentNode.removeChild(OldForms[0]);
+
     while (OldForms[0]) OldForms[0].parentNode.removeChild(OldForms[0]);
 
     var OldLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
 
     var OldLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
     for(var a=0;a<OldLinks.length;a++){
+
     for (var a = 0; a < OldLinks.length; a++) {
         OldLinks[a].style.display="";
+
         OldLinks[a].style.display = "";
 
     }
 
     }
     for(var a=0;a<hotcat_CatLinkMatrix.length;a++){
+
     for (var a = 0; a < hotcat_CatLinkMatrix.length; a++) {
         if(!hotcat_CatLinkMatrix[a]) continue;
+
         if (!hotcat_CatLinkMatrix[a]) continue;
         if(hotcat_CatLinkIsRedMatrix[a]){
+
         if (hotcat_CatLinkIsRedMatrix[a]) {
             if(!$(hotcat_CatLinkMatrix[a]).hasClass("new")) $(hotcat_CatLinkMatrix[a]).addClass("new");
+
             if (!$(hotcat_CatLinkMatrix[a]).hasClass("new")) $(hotcat_CatLinkMatrix[a]).addClass("new");
         }else{
+
         } else {
 
             $(hotcat_CatLinkMatrix[a]).removeClass("new");
 
             $(hotcat_CatLinkMatrix[a]).removeClass("new");
 
         }
 
         }
 
     }
 
     }
 
     var OldSpans = document.getElementById('mw-normal-catlinks').getElementsByTagName('span');
 
     var OldSpans = document.getElementById('mw-normal-catlinks').getElementsByTagName('span');
     for(var a=0;a<OldSpans.length;a++){
+
     for (var a = 0; a < OldSpans.length; a++) {
         if(OldSpans[a].id != 'OldDefaultSortSpan') OldSpans[a].style.display="";
+
         if (OldSpans[a].id != 'OldDefaultSortSpan') OldSpans[a].style.display = "";
 
     }
 
     }
     if(!document.getElementById("hotcat_addlink")) hotcat_add_new ( document.getElementById("hotcat_add") );
+
     if (!document.getElementById("hotcat_addlink")) hotcat_add_new(document.getElementById("hotcat_add"));
 
     var Legend = "";
 
     var Legend = "";
     if(hotcat_ShowLegend){
+
     if (hotcat_ShowLegend) {
         Legend = '<small>'
+
         Legend = '<small>' +
              + '<a href="'+hotcat_docURL+'" title="'+hotcat_text_LabelTitle+'" target="_blank" '
+
            '<a href="' + hotcat_docURL + '" title="' + hotcat_text_LabelTitle + '" target="_blank" ' +
              + 'style="color:#002BB8;padding:0.2em;margin-left:'+(hotcat_ShowInline ? 5 :100 )+'px;">'
+
            'style="color:#002BB8;padding:0.2em;margin-left:' + (hotcat_ShowInline ? 5 : 100) + 'px;">' +
              + '&nbsp;<b>'+hotcat_text_LabelText+'</b>'
+
            '&nbsp;<b>' + hotcat_text_LabelText + '</b>' +
              + '&nbsp;<span class="RemovedCategory">'+hotcat_text_RecapRemove+'</span>'
+
            '&nbsp;<span class="RemovedCategory">' + hotcat_text_RecapRemove + '</span>' +
              + '&nbsp;<span class="ModifiedCategory">'+hotcat_text_RecapModify+'</span>'
+
            '&nbsp;<span class="ModifiedCategory">' + hotcat_text_RecapModify + '</span>' +
              + '&nbsp;<span class="AddedCategory">'+hotcat_text_RecapAdd+'</span>'
+
            '&nbsp;<span class="AddedCategory">' + hotcat_text_RecapAdd + '</span>' +
              + '</a>'
+
            '</a>' +
              + '</small>';
+
            '</small>';
 
     }
 
     }
 
     var BR = "";
 
     var BR = "";
     if(!hotcat_ShowInline) BR = "<br />";
+
     if (!hotcat_ShowInline) BR = "<br />";
  
 
     var RadioBoxes = "";
 
     var RadioBoxes = "";
     if(!hotcat_Multi_IsEditPage){
+
     if (!hotcat_Multi_IsEditPage) {
         var MinorOneChecked = ( (hotcat_Minoredit==-1) ? 'checked="checked" ' : '' );
+
         var MinorOneChecked = ((hotcat_Minoredit == -1) ? 'checked="checked" ' : '');
         var MinorTwoChecked = ( (hotcat_Minoredit==0) ? 'checked="checked" ' : '' );
+
         var MinorTwoChecked = ((hotcat_Minoredit == 0) ? 'checked="checked" ' : '');
         var MinorThreeChecked = ( (hotcat_Minoredit==1) ? 'checked="checked" ' : '' );
+
         var MinorThreeChecked = ((hotcat_Minoredit == 1) ? 'checked="checked" ' : '');
         var WatchOneChecked = ( (hotcat_Watchthis==-1) ? 'checked="checked" ' : '' );
+
         var WatchOneChecked = ((hotcat_Watchthis == -1) ? 'checked="checked" ' : '');
         var WatchTwoChecked = ( (hotcat_Watchthis==0) ? 'checked="checked" ' : '' );
+
         var WatchTwoChecked = ((hotcat_Watchthis == 0) ? 'checked="checked" ' : '');
         var WatchThreeChecked = ( (hotcat_Watchthis==1) ? 'checked="checked" ' : '' );
+
         var WatchThreeChecked = ((hotcat_Watchthis == 1) ? 'checked="checked" ' : '');
         RadioBoxes = '<span id="hotcat_RadioBoxes">'
+
         RadioBoxes = '<span id="hotcat_RadioBoxes">' +
                  + '&nbsp;&nbsp;<span style="border:1px dotted silver;padding:0.1em;">'
+
            '&nbsp;&nbsp;<span style="border:1px dotted silver;padding:0.1em;">' +
                  + '<input id="Minor" type="radio" name="Minor" '+MinorOneChecked+' style="cursor:pointer;" '
+
            '<input id="Minor" type="radio" name="Minor" ' + MinorOneChecked + ' style="cursor:pointer;" ' +
                  + 'title="'+hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioDefault)+'" />'
+
            'title="' + hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioDefault) + '" />' +
                  + '<input id="Minor_0" type="radio" name="Minor" '+MinorTwoChecked+' style="cursor:pointer;" '
+
            '<input id="Minor_0" type="radio" name="Minor" ' + MinorTwoChecked + ' style="cursor:pointer;" ' +
                  + 'title="'+hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioNo)+'" />'
+
            'title="' + hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioNo) + '" />' +
                  + '<input id="Minor-1" type="radio" name="Minor" '+MinorThreeChecked+' style="cursor:pointer;" '
+
            '<input id="Minor-1" type="radio" name="Minor" ' + MinorThreeChecked + ' style="cursor:pointer;" ' +
                  + 'title="'+hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioYes)+'" />'
+
            'title="' + hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioYes) + '" />' +
                  + '</span>&nbsp;&nbsp;<span style="border:1px dotted silver;padding:0.1em;">'
+
            '</span>&nbsp;&nbsp;<span style="border:1px dotted silver;padding:0.1em;">' +
                  + '<input id="Watch" type="radio" name="Watch" '+WatchOneChecked+' style="cursor:pointer;" '
+
            '<input id="Watch" type="radio" name="Watch" ' + WatchOneChecked + ' style="cursor:pointer;" ' +
                  + 'title="'+hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioDefault)+'" />'
+
            'title="' + hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioDefault) + '" />' +
                  + '<input id="Watch0" type="radio" name="Watch" '+WatchTwoChecked+' style="cursor:pointer;" '
+
            '<input id="Watch0" type="radio" name="Watch" ' + WatchTwoChecked + ' style="cursor:pointer;" ' +
                  + 'title="'+hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioNo)+'" />'
+
            'title="' + hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioNo) + '" />' +
                  + '<input id="Watch1" type="radio" name="Watch" '+WatchThreeChecked+' style="cursor:pointer;" '
+
            '<input id="Watch1" type="radio" name="Watch" ' + WatchThreeChecked + ' style="cursor:pointer;" ' +
                  + 'title="'+hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioYes)+'" />'
+
            'title="' + hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioYes) + '" />' +
                  + '</span>'
+
            '</span>' +
                  + '</span>';
+
            '</span>';
 
     }
 
     }
  
Ligne 1 022 : Ligne 1 027 :
 
     Form.id = "hotcat_modify_multi_form";
 
     Form.id = "hotcat_modify_multi_form";
 
     Form.style.display = "inline";
 
     Form.style.display = "inline";
     Form.innerHTML = ''
+
     Form.innerHTML = '' +
                  + Legend
+
        Legend +
                  + BR
+
        BR +
                  + '<input id="hotcat_modify_multi_InputOK" type="button" disabled="disabled" '
+
        '<input id="hotcat_modify_multi_InputOK" type="button" disabled="disabled" ' +
                  + 'value="'+hotcat_text_MultiInputOK+'" '
+
        'value="' + hotcat_text_MultiInputOK + '" ' +
                  + 'onclick="hotcat_multiedit_FormOK()" onselect="hotcat_multiedit_FormOK()" />'
+
        'onclick="hotcat_multiedit_FormOK()" onselect="hotcat_multiedit_FormOK()" />' +
                  + '<input id="hotcat_modify_multi_InputCancel" type="button" '
+
        '<input id="hotcat_modify_multi_InputCancel" type="button" ' +
                  + 'value="'+hotcat_text_MultiInputCancel+'" '
+
        'value="' + hotcat_text_MultiInputCancel + '" ' +
                  + 'onclick="hotcat_multiedit_CancelForm()" onselect="hotcat_multiedit_CancelForm()" />'
+
        'onclick="hotcat_multiedit_CancelForm()" onselect="hotcat_multiedit_CancelForm()" />' +
                  + RadioBoxes
+
        RadioBoxes +
                  + BR;
+
        BR;
 
     Span.appendChild(Form);
 
     Span.appendChild(Form);
 
     Link.style.display = "none";
 
     Link.style.display = "none";
 
     hotcat_Multi_Edit = true;
 
     hotcat_Multi_Edit = true;
     if(!hotcat_AutoMulti) document.getElementById("hotcat_modify_multi_InputCancel").focus();
+
     if (!hotcat_AutoMulti) document.getElementById("hotcat_modify_multi_InputCancel").focus();
 
};
 
};
  
 
// ANNULATION DU FORMULAIRE "MULTI" + MODIFICATION DES LIENS, FONCTIONS ET IDS DE LA BARRE DE CATÉGORIES
 
// ANNULATION DU FORMULAIRE "MULTI" + MODIFICATION DES LIENS, FONCTIONS ET IDS DE LA BARRE DE CATÉGORIES
  
window.hotcat_multiedit_CancelForm = function(){
+
window.hotcat_multiedit_CancelForm = function() {
 
     var Link = document.getElementById('hotcat_modify_multi_Link');
 
     var Link = document.getElementById('hotcat_modify_multi_Link');
 
     var Form = document.getElementById('hotcat_modify_multi_form');
 
     var Form = document.getElementById('hotcat_modify_multi_form');
     if(Link) Link.style.display = "inline";
+
     if (Link) Link.style.display = "inline";
 
     var CatForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
 
     var CatForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
     while(CatForms[0]){
+
     while (CatForms[0]) {
 
         CatForms[0].parentNode.removeChild(CatForms[0]);
 
         CatForms[0].parentNode.removeChild(CatForms[0]);
 
     }
 
     }
 
     var CatSpans = document.getElementById('mw-normal-catlinks').getElementsByTagName('span');
 
     var CatSpans = document.getElementById('mw-normal-catlinks').getElementsByTagName('span');
 
     var SpanToRemove = [];
 
     var SpanToRemove = [];
     for(var a=1;a<CatSpans.length;a++){
+
     for (var a = 1; a < CatSpans.length; a++) {
         if($(CatSpans[a]).hasClass("AddedCatSpan")) SpanToRemove.push(CatSpans[a]);
+
         if ($(CatSpans[a]).hasClass("AddedCatSpan")) SpanToRemove.push(CatSpans[a]);
 
     }
 
     }
     for(var a=0;a<SpanToRemove.length;a++){
+
     for (var a = 0; a < SpanToRemove.length; a++) {
 
         SpanToRemove[a].parentNode.removeChild(SpanToRemove[a]);
 
         SpanToRemove[a].parentNode.removeChild(SpanToRemove[a]);
 
     }
 
     }
 
     var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
 
     var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
     for(var a=0;a<CatLinks.length;a++){
+
     for (var a = 0; a < CatLinks.length; a++) {
 
         CatLinks[a].style.display = "inline";
 
         CatLinks[a].style.display = "inline";
 
         $(CatLinks[a]).removeClass("RemovedCategory");
 
         $(CatLinks[a]).removeClass("RemovedCategory");
         if($(CatLinks[a]).hasClass("ModifiedCategory")){
+
         if ($(CatLinks[a]).hasClass("ModifiedCategory")) {
             var Index = hotcat_getIndex( CatLinks[a] );
+
             var Index = hotcat_getIndex(CatLinks[a]);
 
             var Parent = CatLinks[a].parentNode;
 
             var Parent = CatLinks[a].parentNode;
 
             var OldCatName = hotcat_CatNameMatrix[Index];
 
             var OldCatName = hotcat_CatNameMatrix[Index];
Ligne 1 068 : Ligne 1 073 :
 
             hotcat_SortMatrix[Index] = OldDefaultSort;
 
             hotcat_SortMatrix[Index] = OldDefaultSort;
 
             CatLinks[a].innerHTML = OldCatName;
 
             CatLinks[a].innerHTML = OldCatName;
             CatLinks[a].title = hotcat_CatNamespace+OldCatName;
+
             CatLinks[a].title = hotcat_CatNamespace + OldCatName;
             CatLinks[a].href = mw.config.get('wgServer')+mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace+OldCatName);
+
             CatLinks[a].href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + OldCatName);
 
             $(CatLinks[a]).removeClass("ModifiedCategory");
 
             $(CatLinks[a]).removeClass("ModifiedCategory");
 
         }
 
         }
         if($(CatLinks[a]).hasClass("ModifiedDefaultSort")){
+
         if ($(CatLinks[a]).hasClass("ModifiedDefaultSort")) {
 
             var DefaultSortSpan = document.getElementById("OldDefaultSortSpan");
 
             var DefaultSortSpan = document.getElementById("OldDefaultSortSpan");
 
             DefaultSortSpan.innerHTML = hotcat_OldDefaultSort;
 
             DefaultSortSpan.innerHTML = hotcat_OldDefaultSort;
Ligne 1 078 : Ligne 1 083 :
 
         }
 
         }
 
     }
 
     }
     for(var a=0;a<hotcat_CatLinkMatrix.length;a++){
+
     for (var a = 0; a < hotcat_CatLinkMatrix.length; a++) {
         if(!hotcat_CatLinkMatrix[a]) continue;
+
         if (!hotcat_CatLinkMatrix[a]) continue;
         if(hotcat_CatLinkIsRedMatrix[a]){
+
         if (hotcat_CatLinkIsRedMatrix[a]) {
             if(!$(hotcat_CatLinkMatrix[a]).hasClass("new")) $(hotcat_CatLinkMatrix[a]).addClass("new");
+
             if (!$(hotcat_CatLinkMatrix[a]).hasClass("new")) $(hotcat_CatLinkMatrix[a]).addClass("new");
         }else{
+
         } else {
 
             $(hotcat_CatLinkMatrix[a]).removeClass("new");
 
             $(hotcat_CatLinkMatrix[a]).removeClass("new");
 
         }
 
         }
Ligne 1 092 : Ligne 1 097 :
 
// VALIDATION DU FORMULAIRE "MULTI" + LISTING DES CATÉGORIES À ENLEVER/MODIFIER/AJOUTER
 
// VALIDATION DU FORMULAIRE "MULTI" + LISTING DES CATÉGORIES À ENLEVER/MODIFIER/AJOUTER
  
window.hotcat_multiedit_FormOK = function(){
+
window.hotcat_multiedit_FormOK = function() {
 
     var RemovedCategories = [];
 
     var RemovedCategories = [];
 
     var ModifiedCategories_from = [];
 
     var ModifiedCategories_from = [];
Ligne 1 099 : Ligne 1 104 :
 
     var DefaultSort = hotcat_OldDefaultSort;
 
     var DefaultSort = hotcat_OldDefaultSort;
 
     var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
 
     var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
     for(var a=0;a<CatLinks.length;a++){
+
     for (var a = 0; a < CatLinks.length; a++) {
 
         var Link = CatLinks[a];
 
         var Link = CatLinks[a];
         var Index = hotcat_getIndex( Link );
+
         var Index = hotcat_getIndex(Link);
         if($(Link).hasClass("RemovedCategory")){
+
         if ($(Link).hasClass("RemovedCategory")) {
 
             RemovedCategories.push(Link.innerHTML.ucFirst());
 
             RemovedCategories.push(Link.innerHTML.ucFirst());
 
         }
 
         }
         if($(Link).hasClass("ModifiedCategory")){
+
         if ($(Link).hasClass("ModifiedCategory")) {
 
             var NewCatName = Link.innerHTML.ucFirst();
 
             var NewCatName = Link.innerHTML.ucFirst();
 
             var OldCatName = hotcat_CatNameMatrix[Index];
 
             var OldCatName = hotcat_CatNameMatrix[Index];
 
             var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
 
             var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
 
             var NewDefaultSort = hotcat_SortMatrix[Index];
 
             var NewDefaultSort = hotcat_SortMatrix[Index];
             if((OldCatName+OldDefaultSort)!=(NewCatName+NewDefaultSort)){
+
             if ((OldCatName + OldDefaultSort) != (NewCatName + NewDefaultSort)) {
                 ModifiedCategories_from.push((OldCatName+OldDefaultSort));
+
                 ModifiedCategories_from.push((OldCatName + OldDefaultSort));
                 ModifiedCategories_to.push((NewCatName+NewDefaultSort));
+
                 ModifiedCategories_to.push((NewCatName + NewDefaultSort));
 
             }
 
             }
 
         }
 
         }
         if($(Link).hasClass("AddedCategory")){
+
         if ($(Link).hasClass("AddedCategory")) {
 
             var NewDefaultSort = hotcat_SortMatrix[Index];
 
             var NewDefaultSort = hotcat_SortMatrix[Index];
             AddedCategories.push(Link.innerHTML.ucFirst()+NewDefaultSort);
+
             AddedCategories.push(Link.innerHTML.ucFirst() + NewDefaultSort);
 
         }
 
         }
         if($(Link).hasClass("ModifiedDefaultSort")){
+
         if ($(Link).hasClass("ModifiedDefaultSort")) {
 
             var DefaultSortSpan = document.getElementById("OldDefaultSortSpan");
 
             var DefaultSortSpan = document.getElementById("OldDefaultSortSpan");
 
             DefaultSort = DefaultSortSpan.innerHTML;
 
             DefaultSort = DefaultSortSpan.innerHTML;
Ligne 1 129 : Ligne 1 134 :
 
     var Newhotcat_Minoredit = false;
 
     var Newhotcat_Minoredit = false;
 
     var Newhotcat_Watchthis = false;
 
     var Newhotcat_Watchthis = false;
     if(RadioBoxesSpan){
+
     if (RadioBoxesSpan) {
 
         var RadioBoxes = RadioBoxesSpan.getElementsByTagName('input');
 
         var RadioBoxes = RadioBoxesSpan.getElementsByTagName('input');
         for(var a=0;a<RadioBoxes.length;a++){
+
         for (var a = 0; a < RadioBoxes.length; a++) {
             if(RadioBoxes[a].type!="radio") continue;
+
             if (RadioBoxes[a].type != "radio") continue;
             if(!RadioBoxes[a].checked) continue;
+
             if (!RadioBoxes[a].checked) continue;
 
             var BoxName = RadioBoxes[a].name;
 
             var BoxName = RadioBoxes[a].name;
 
             var Number = hotcat_getIndex(RadioBoxes[a]);
 
             var Number = hotcat_getIndex(RadioBoxes[a]);
             if(BoxName=="Minor"){
+
             if (BoxName == "Minor") {
 
                 var Minor = -1;
 
                 var Minor = -1;
 
                 var TextMinor = hotcat_text_RadioDefault;
 
                 var TextMinor = hotcat_text_RadioDefault;
                 if(Number==0){
+
                 if (Number == 0) {
 
                     Minor = Number;
 
                     Minor = Number;
 
                     TextMinor = hotcat_text_RadioNo;
 
                     TextMinor = hotcat_text_RadioNo;
                 }else if(Number==1){
+
                 } else if (Number == 1) {
 
                     Minor = Number;
 
                     Minor = Number;
 
                     TextMinor = hotcat_text_RadioYes;
 
                     TextMinor = hotcat_text_RadioYes;
 
                 }
 
                 }
 
                 Newhotcat_Minoredit = Minor;
 
                 Newhotcat_Minoredit = Minor;
                 RecapMinor += hotcat_text_Minoredit.split("$1").join(TextMinor)+ '\n';
+
                 RecapMinor += hotcat_text_Minoredit.split("$1").join(TextMinor) + '\n';
             }else if(BoxName=="Watch"){
+
             } else if (BoxName == "Watch") {
 
                 var Watch = -1;
 
                 var Watch = -1;
 
                 var TextWatch = hotcat_text_RadioDefault;
 
                 var TextWatch = hotcat_text_RadioDefault;
                 if(Number==0){
+
                 if (Number == 0) {
 
                     Watch = Number;
 
                     Watch = Number;
 
                     TextWatch = hotcat_text_RadioNo;
 
                     TextWatch = hotcat_text_RadioNo;
                 }else if(Number==1){
+
                 } else if (Number == 1) {
 
                     Watch = Number;
 
                     Watch = Number;
 
                     TextWatch = hotcat_text_RadioYes;
 
                     TextWatch = hotcat_text_RadioYes;
 
                 }
 
                 }
 
                 Newhotcat_Watchthis = Watch;
 
                 Newhotcat_Watchthis = Watch;
                 RecapWatch += hotcat_text_Watchthis.split("$1").join(TextWatch)+ '\n';
+
                 RecapWatch += hotcat_text_Watchthis.split("$1").join(TextWatch) + '\n';
 
             }
 
             }
 
         }
 
         }
 
     }
 
     }
     var TextrecapTitle = hotcat_text_RecapTitle+'\n\n';
+
     var TextrecapTitle = hotcat_text_RecapTitle + '\n\n';
 
     var TextRecap = TextrecapTitle;
 
     var TextRecap = TextrecapTitle;
     if(RemovedCategories[0]){
+
     if (RemovedCategories[0]) {
         TextRecap += hotcat_text_RecapRemove+' :\n';
+
         TextRecap += hotcat_text_RecapRemove + ' :\n';
         for(var a=0;a<RemovedCategories.length;a++){
+
         for (var a = 0; a < RemovedCategories.length; a++) {
             TextRecap += '* « '+RemovedCategories[a]+' »\n';
+
             TextRecap += '* « ' + RemovedCategories[a] + ' »\n';
 
         }
 
         }
 
     }
 
     }
     if(ModifiedCategories_to[0]){
+
     if (ModifiedCategories_to[0]) {
         TextRecap += hotcat_text_RecapModify+' :\n';
+
         TextRecap += hotcat_text_RecapModify + ' :\n';
         for(var a=0;a<ModifiedCategories_to.length;a++){
+
         for (var a = 0; a < ModifiedCategories_to.length; a++) {
             TextRecap += '* « '+ModifiedCategories_from[a]+' » -> « '+ModifiedCategories_to[a]+' »\n';
+
             TextRecap += '* « ' + ModifiedCategories_from[a] + ' » -> « ' + ModifiedCategories_to[a] + ' »\n';
 
         }
 
         }
 
     }
 
     }
     if(AddedCategories[0]){
+
     if (AddedCategories[0]) {
         TextRecap += hotcat_text_RecapAdd+' :\n';
+
         TextRecap += hotcat_text_RecapAdd + ' :\n';
         for(var a=0;a<AddedCategories.length;a++){
+
         for (var a = 0; a < AddedCategories.length; a++) {
             TextRecap += '* « '+AddedCategories[a]+' »\n';
+
             TextRecap += '* « ' + AddedCategories[a] + ' »\n';
 
         }
 
         }
 
     }
 
     }
     if(DefaultSort!=hotcat_OldDefaultSort){
+
     if (DefaultSort != hotcat_OldDefaultSort) {
         TextRecap += hotcat_text_RecapSort+' :\n';
+
         TextRecap += hotcat_text_RecapSort + ' :\n';
         TextRecap += '* « '+hotcat_OldDefaultSort+' » -> « '+DefaultSort+' »\n';
+
         TextRecap += '* « ' + hotcat_OldDefaultSort + ' » -> « ' + DefaultSort + ' »\n';
 
     }
 
     }
     if(TextRecap == TextrecapTitle) return;
+
     if (TextRecap == TextrecapTitle) return;
 
     TextRecap += RecapMinor;
 
     TextRecap += RecapMinor;
 
     TextRecap += RecapWatch;
 
     TextRecap += RecapWatch;
     if(hotcat_SkipRecap || confirm(TextRecap)){
+
     if (hotcat_SkipRecap || confirm(TextRecap)) {
 
         hotcat_Minoredit = Newhotcat_Minoredit;
 
         hotcat_Minoredit = Newhotcat_Minoredit;
 
         hotcat_Watchthis = Newhotcat_Watchthis;
 
         hotcat_Watchthis = Newhotcat_Watchthis;
Ligne 1 199 : Ligne 1 204 :
 
// VÉRIFICATION DES CHANGEMENTS EFFECTUÉS
 
// VÉRIFICATION DES CHANGEMENTS EFFECTUÉS
  
window.hotcat_Multi_CheckForChanges = function(){
+
window.hotcat_Multi_CheckForChanges = function() {
     if(!hotcat_Multi_Edit) return;
+
     if (!hotcat_Multi_Edit) return;
 
     var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
 
     var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
 
     var AnythingChanged = false;
 
     var AnythingChanged = false;
     for(var a=0;a<CatLinks.length;a++){
+
     for (var a = 0; a < CatLinks.length; a++) {
 
         var Link = CatLinks[a];
 
         var Link = CatLinks[a];
         if(($(Link).hasClass("RemovedCategory"))||($(Link).hasClass("ModifiedCategory"))||($(Link).hasClass("AddedCategory"))||($(Link).hasClass("ModifiedDefaultSort"))){
+
         if (($(Link).hasClass("RemovedCategory")) || ($(Link).hasClass("ModifiedCategory")) || ($(Link).hasClass("AddedCategory")) || ($(Link).hasClass("ModifiedDefaultSort"))) {
 
             AnythingChanged = true;
 
             AnythingChanged = true;
 
         }
 
         }
 
     }
 
     }
     if(AnythingChanged){
+
     if (AnythingChanged) {
 
         document.getElementById('hotcat_modify_multi_InputOK').disabled = "";
 
         document.getElementById('hotcat_modify_multi_InputOK').disabled = "";
     }else{
+
     } else {
 
         document.getElementById('hotcat_modify_multi_InputOK').disabled = "disabled";
 
         document.getElementById('hotcat_modify_multi_InputOK').disabled = "disabled";
 
     }
 
     }
Ligne 1 220 : Ligne 1 225 :
 
// RÉCUPÉRATION CLEF DE TRI GLOBALE
 
// RÉCUPÉRATION CLEF DE TRI GLOBALE
  
window.hotcat_defaultSort_getOld = function(ID){
+
window.hotcat_defaultSort_getOld = function(ID) {
 
     var OldDefaultSpan = document.getElementById(ID);
 
     var OldDefaultSpan = document.getElementById(ID);
     if(!OldDefaultSpan) return;
+
     if (!OldDefaultSpan) return;
 
     var Page = hotcat_OldPageContent;
 
     var Page = hotcat_OldPageContent;
     for(var a=0;a<hotcat_DefaultsortAliases.length;a++){
+
     for (var a = 0; a < hotcat_DefaultsortAliases.length; a++) {
         if(Page.indexOf('{{'+hotcat_DefaultsortAliases[a]+':')!=-1){
+
         if (Page.indexOf('{{' + hotcat_DefaultsortAliases[a] + ':') != -1) {
             var AvantCle = Page.substring(0,Page.indexOf('{{'+hotcat_DefaultsortAliases[a]+':'));
+
             var AvantCle = Page.substring(0, Page.indexOf('{{' + hotcat_DefaultsortAliases[a] + ':'));
 
             var Cle = Page.split(AvantCle).join('');
 
             var Cle = Page.split(AvantCle).join('');
             Cle = Cle.substring(0,Cle.indexOf("}"));
+
             Cle = Cle.substring(0, Cle.indexOf("}"));
             Cle = Cle.substring((Cle.indexOf(":")+1),Cle.length);
+
             Cle = Cle.substring((Cle.indexOf(":") + 1), Cle.length);
 
             hotcat_OldDefaultSort = Cle;
 
             hotcat_OldDefaultSort = Cle;
 
             OldDefaultSpan.innerHTML = hotcat_OldDefaultSort;
 
             OldDefaultSpan.innerHTML = hotcat_OldDefaultSort;
Ligne 1 239 : Ligne 1 244 :
 
// RÉCUPÉRATION CLEF DE TRI PARTICULIÈRE
 
// RÉCUPÉRATION CLEF DE TRI PARTICULIÈRE
  
window.hotcat_defaultSort_getOneOld = function(TargetCategory){
+
window.hotcat_defaultSort_getOneOld = function(TargetCategory) {
 
     var Page = hotcat_OldPageContent;
 
     var Page = hotcat_OldPageContent;
 
     var Key = "";
 
     var Key = "";
 
     var CurrentKey = "";
 
     var CurrentKey = "";
     var REGEXP = new RegExp("(\\s*)\\[\\[ *(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category) *: *" + TargetCategory.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
+
     var REGEXP = new RegExp("(\\s*)\\[\\[ *(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category) *: *" + TargetCategory.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
 
     var matches = Page.match(REGEXP);
 
     var matches = Page.match(REGEXP);
     if (matches != null && matches.length == 1){
+
     if (matches != null && matches.length == 1) {
 
         CurrentKey = Page.replace(REGEXP, "DEFAULTKEYstart$2DEFAULTKEYend");
 
         CurrentKey = Page.replace(REGEXP, "DEFAULTKEYstart$2DEFAULTKEYend");
         if((CurrentKey.indexOf("DEFAULTKEYstart")!=-1)&&(CurrentKey.indexOf("DEFAULTKEYend")!=-1)){
+
         if ((CurrentKey.indexOf("DEFAULTKEYstart") != -1) && (CurrentKey.indexOf("DEFAULTKEYend") != -1)) {
             var Before = CurrentKey.split("DEFAULTKEYstart")[0]+"DEFAULTKEYstart";
+
             var Before = CurrentKey.split("DEFAULTKEYstart")[0] + "DEFAULTKEYstart";
             var After = "DEFAULTKEYend"+CurrentKey.split("DEFAULTKEYend")[1];
+
             var After = "DEFAULTKEYend" + CurrentKey.split("DEFAULTKEYend")[1];
 
             CurrentKey = CurrentKey.split(Before).join("");
 
             CurrentKey = CurrentKey.split(Before).join("");
 
             CurrentKey = CurrentKey.split(After).join("");
 
             CurrentKey = CurrentKey.split(After).join("");
             if(CurrentKey.indexOf('|')!=-1) Key = CurrentKey;
+
             if (CurrentKey.indexOf('|') != -1) Key = CurrentKey;
 
         }
 
         }
 
     }
 
     }
Ligne 1 260 : Ligne 1 265 :
 
// CRÉATION FORMULAIRE CLEF DE TRI GLOBALE
 
// CRÉATION FORMULAIRE CLEF DE TRI GLOBALE
  
window.hotcat_defaultSort_createForm = function(){
+
window.hotcat_defaultSort_createForm = function() {
 
     hotcat_defaultSort_getOld("OldDefaultSortSpan");
 
     hotcat_defaultSort_getOld("OldDefaultSortSpan");
 
     var thespan = document.getElementById('hotcat_DefaultSort_span');
 
     var thespan = document.getElementById('hotcat_DefaultSort_span');
 
     var OldDefaultSort = thespan.getElementsByTagName('span')[0].innerHTML;
 
     var OldDefaultSort = thespan.getElementsByTagName('span')[0].innerHTML;
 
     thespan.getElementsByTagName('a')[0].style.display = "none";
 
     thespan.getElementsByTagName('a')[0].style.display = "none";
     var form = document.createElement ( "form" ) ;
+
     var form = document.createElement("form");
 
     form.id = "hotcat_form_Default";
 
     form.id = "hotcat_form_Default";
     form.method = "post" ;
+
     form.method = "post";
     form.onsubmit = function () {
+
     form.onsubmit = function() {
         hotcat_Default_ok(this) ;
+
         hotcat_Default_ok(this);
 
         return false;
 
         return false;
    } ;
 
    form.style.display = "inline" ;
 
    var text = document.createElement ( "input" ) ;
 
    text.size = 40 ;
 
    text.id = "hotcat_text_Default" ;
 
    text.type = "text" ;
 
    text.value = OldDefaultSort ;
 
    var OK = document.createElement ( "input" ) ;
 
    OK.type = "button" ;
 
    OK.value = hotcat_text_InputOK ;
 
    OK.onclick = function(){
 
        hotcat_Default_ok(this.parentNode) ;
 
 
     };
 
     };
     var cancel = document.createElement ( "input" ) ;
+
    form.style.display = "inline";
     cancel.type = "button" ;
+
    var text = document.createElement("input");
     cancel.value = hotcat_text_InputCancel ;
+
    text.size = 40;
     cancel.onclick = function(){
+
    text.id = "hotcat_text_Default";
 +
    text.type = "text";
 +
    text.value = OldDefaultSort;
 +
    var OK = document.createElement("input");
 +
    OK.type = "button";
 +
    OK.value = hotcat_text_InputOK;
 +
    OK.onclick = function() {
 +
        hotcat_Default_ok(this.parentNode);
 +
    };
 +
     var cancel = document.createElement("input");
 +
     cancel.type = "button";
 +
     cancel.value = hotcat_text_InputCancel;
 +
     cancel.onclick = function() {
 
         var Form = this.parentNode;
 
         var Form = this.parentNode;
         hotcat_Default_Cancel(Form) ;
+
         hotcat_Default_Cancel(Form);
 
     };
 
     };
     form.appendChild ( text ) ;
+
     form.appendChild(text);
     form.appendChild ( OK ) ;
+
     form.appendChild(OK);
     form.appendChild ( cancel ) ;
+
     form.appendChild(cancel);
     thespan.appendChild ( form ) ;
+
     thespan.appendChild(form);
 
     hotcat_upDate_FormPositions();
 
     hotcat_upDate_FormPositions();
     text.focus () ;
+
     text.focus();
 
};
 
};
  
 
// ANNULATION FORMULAIRE CLEF DE TRI GLOBALE
 
// ANNULATION FORMULAIRE CLEF DE TRI GLOBALE
  
window.hotcat_Default_Cancel = function(Form){
+
window.hotcat_Default_Cancel = function(Form) {
 
     var Span = Form.parentNode;
 
     var Span = Form.parentNode;
 
     Form.parentNode.getElementsByTagName('a')[0].style.display = "";
 
     Form.parentNode.getElementsByTagName('a')[0].style.display = "";
     Form.parentNode.removeChild(Form) ;
+
     Form.parentNode.removeChild(Form);
     if(hotcat_Multi_Edit){
+
     if (hotcat_Multi_Edit) {
 
         Span.getElementsByTagName('span')[0].innerHTML = hotcat_OldDefaultSort;
 
         Span.getElementsByTagName('span')[0].innerHTML = hotcat_OldDefaultSort;
 
         $(Span.getElementsByTagName('a')[0]).removeClass("ModifiedDefaultSort");
 
         $(Span.getElementsByTagName('a')[0]).removeClass("ModifiedDefaultSort");
Ligne 1 316 : Ligne 1 321 :
 
// VALIDATION FORMULAIRE CLEF DE TRI GLOBALE
 
// VALIDATION FORMULAIRE CLEF DE TRI GLOBALE
  
window.hotcat_Default_ok = function(Form){
+
window.hotcat_Default_ok = function(Form) {
 
     var Text = document.getElementById("hotcat_text_Default");
 
     var Text = document.getElementById("hotcat_text_Default");
 
     var OldDefaultSort = hotcat_OldDefaultSort;
 
     var OldDefaultSort = hotcat_OldDefaultSort;
 
     var NewDefaultSort = Text.value;
 
     var NewDefaultSort = Text.value;
     if(!hotcat_Multi_Edit){
+
     if (!hotcat_Multi_Edit) {
         if(OldDefaultSort==NewDefaultSort){
+
         if (OldDefaultSort == NewDefaultSort) {
 
             hotcat_Default_Cancel(Form);
 
             hotcat_Default_Cancel(Form);
 
             return;
 
             return;
         }else{
+
         } else {
 
             var RemovedCategories = [];
 
             var RemovedCategories = [];
 
             var ModifiedCategories_from = [];
 
             var ModifiedCategories_from = [];
 
             var ModifiedCategories_to = [];
 
             var ModifiedCategories_to = [];
 
             var AddedCategories = [];
 
             var AddedCategories = [];
             var DefaultSort = NewDefaultSort ;
+
             var DefaultSort = NewDefaultSort;
 
             hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
 
             hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
 
         }
 
         }
     }else{
+
     } else {
         if(OldDefaultSort==NewDefaultSort){
+
         if (OldDefaultSort == NewDefaultSort) {
 
             hotcat_Default_Cancel(Form);
 
             hotcat_Default_Cancel(Form);
 
             return;
 
             return;
         }else{
+
         } else {
 
             var Span = Form.parentNode;
 
             var Span = Form.parentNode;
 
             Span.getElementsByTagName('span')[0].innerHTML = Text.value;
 
             Span.getElementsByTagName('span')[0].innerHTML = Text.value;
Ligne 1 342 : Ligne 1 347 :
 
             Link.style.display = "";
 
             Link.style.display = "";
 
             $(Link).addClass("ModifiedDefaultSort");
 
             $(Link).addClass("ModifiedDefaultSort");
             Form.parentNode.removeChild(Form) ;
+
             Form.parentNode.removeChild(Form);
 
             hotcat_Multi_CheckForChanges();
 
             hotcat_Multi_CheckForChanges();
 
             hotcat_upDate_FormPositions();
 
             hotcat_upDate_FormPositions();
Ligne 1 352 : Ligne 1 357 :
 
///////////////////////// ÉDITION ////////////////////////////////////////////////////////
 
///////////////////////// ÉDITION ////////////////////////////////////////////////////////
  
window.hotcat_Edit = function(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort){
+
window.hotcat_Edit = function(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort) {
     if(hotcat_Multi_IsEditPage){
+
     if (hotcat_Multi_IsEditPage) {
 
         hotcat_autocommit = false;
 
         hotcat_autocommit = false;
 
         hotcat_DoEdit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
 
         hotcat_DoEdit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
Ligne 1 359 : Ligne 1 364 :
 
         return;
 
         return;
 
     }
 
     }
     var URL = mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+encodeURIComponent(mw.config.get('wgPageName'))+'&action=edit';
+
     var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit';
     hotcat_ajax.http({url             : URL,
+
     hotcat_ajax.http({
                      onSuccess       : hotcat_TrueEdit,
+
        url: URL,
                      removedcats     : RemovedCategories,
+
        onSuccess: hotcat_TrueEdit,
                      modifiedcatsfrom : ModifiedCategories_from,
+
        removedcats: RemovedCategories,
                      modifiedcatsto   : ModifiedCategories_to,
+
        modifiedcatsfrom: ModifiedCategories_from,
                      addedcats       : AddedCategories,
+
        modifiedcatsto: ModifiedCategories_to,
                      defaultsort     : DefaultSort
+
        addedcats: AddedCategories,
 +
        defaultsort: DefaultSort
 
     });
 
     });
 
};
 
};
  
window.hotcat_TrueEdit = function(Req, data){
+
window.hotcat_TrueEdit = function(Req, data) {
 
     var RemovedCategories = data.removedcats;
 
     var RemovedCategories = data.removedcats;
 
     var ModifiedCategories_from = data.modifiedcatsfrom;
 
     var ModifiedCategories_from = data.modifiedcatsfrom;
Ligne 1 376 : Ligne 1 382 :
 
     var AddedCategories = data.addedcats;
 
     var AddedCategories = data.addedcats;
 
     var DefaultSort = data.defaultsort;
 
     var DefaultSort = data.defaultsort;
     while(document.body.firstChild){document.body.removeChild(document.body.firstChild);}
+
     while (document.body.firstChild) {
 +
        document.body.removeChild(document.body.firstChild);
 +
    }
 
     document.body.innerHTML = Req.responseText;
 
     document.body.innerHTML = Req.responseText;
 
     hotcat_DoEdit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
 
     hotcat_DoEdit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
 
};
 
};
  
window.hotcat_DoEdit = function(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort){
+
window.hotcat_DoEdit = function(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort) {
 
     var prevent_autocommit = 0;
 
     var prevent_autocommit = 0;
     if(typeof(hotcat_EditCustom)=="function") hotcat_EditCustom();
+
     if (typeof(hotcat_EditCustom) == "function") hotcat_EditCustom();
     if(hotcat_autocommit)document.editform.style.display = "none";
+
     if (hotcat_autocommit) document.editform.style.display = "none";
     for(var a=0,l=ModifiedCategories_to.length;a<l;a++){
+
     for (var a = 0, l = ModifiedCategories_to.length; a < l; a++) {
         ModifiedCategories_to[a] = ModifiedCategories_to[a].replace(new RegExp("^"+hotcat_CatNamespace, "ig"), "");
+
         ModifiedCategories_to[a] = ModifiedCategories_to[a].replace(new RegExp("^" + hotcat_CatNamespace, "ig"), "");
 
     }
 
     }
     for(var a=0,l=AddedCategories.length;a<l;a++){
+
     for (var a = 0, l = AddedCategories.length; a < l; a++) {
         AddedCategories[a] = AddedCategories[a].replace(new RegExp("^"+hotcat_CatNamespace, "ig"), "");
+
         AddedCategories[a] = AddedCategories[a].replace(new RegExp("^" + hotcat_CatNamespace, "ig"), "");
 
     }
 
     }
 
     var OldText = document.getElementById('wpTextbox1').value;
 
     var OldText = document.getElementById('wpTextbox1').value;
 
     var summary = [];
 
     var summary = [];
     for(var a=0;a<RemovedCategories.length;a++){
+
     for (var a = 0; a < RemovedCategories.length; a++) {
 
         var OldCatName = RemovedCategories[a];
 
         var OldCatName = RemovedCategories[a];
 
         var OldCatNameUnsorted = OldCatName.replace(/\|.*/, "");
 
         var OldCatNameUnsorted = OldCatName.replace(/\|.*/, "");
         var REGEXP = new RegExp("(\\s*)\\[\\[ *(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category) *: *" + OldCatName.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
+
         var REGEXP = new RegExp("(\\s*)\\[\\[ *(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category) *: *" + OldCatName.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
 
         var matchesCatName = OldText.match(REGEXP);
 
         var matchesCatName = OldText.match(REGEXP);
 
         if (matchesCatName != null && matchesCatName.length == 1) {
 
         if (matchesCatName != null && matchesCatName.length == 1) {
 
             OldText = OldText.replace(REGEXP, "");
 
             OldText = OldText.replace(REGEXP, "");
             summary.push( " – [[" + hotcat_CatNamespace+OldCatNameUnsorted + "]]" ) ;
+
             summary.push(" – [[" + hotcat_CatNamespace + OldCatNameUnsorted + "]]");
         }else{
+
         } else {
 
             prevent_autocommit = 1;
 
             prevent_autocommit = 1;
             if(matchesCatNameUnsorted == null){
+
             if (matchesCatNameUnsorted == null) {
 
                 alert(hotcat_text_AlertProblem1.split('$1').join(OldCatNameUnsorted));
 
                 alert(hotcat_text_AlertProblem1.split('$1').join(OldCatNameUnsorted));
             }else if(matchesCatNameUnsorted.length > 1){
+
             } else if (matchesCatNameUnsorted.length > 1) {
 
                 alert(hotcat_text_AlertProblem3.split('$1').join(OldCatNameUnsorted));
 
                 alert(hotcat_text_AlertProblem3.split('$1').join(OldCatNameUnsorted));
 
             }
 
             }
 
         }
 
         }
 
     }
 
     }
     if((RemovedCategories[0])&&((ModifiedCategories_from[0])||(AddedCategories[0]))) summary.push(" |");
+
     if ((RemovedCategories[0]) && ((ModifiedCategories_from[0]) || (AddedCategories[0]))) summary.push(" |");
     for(var a=0;a<ModifiedCategories_from.length;a++){
+
     for (var a = 0; a < ModifiedCategories_from.length; a++) {
 
         var OldCatName = ModifiedCategories_from[a];
 
         var OldCatName = ModifiedCategories_from[a];
 
         var OldCatNameUnsorted = OldCatName.replace(/\|.*/, "");
 
         var OldCatNameUnsorted = OldCatName.replace(/\|.*/, "");
Ligne 1 420 : Ligne 1 428 :
 
         var matchesOldCatName = OldText.match(REGEXP_OLD);
 
         var matchesOldCatName = OldText.match(REGEXP_OLD);
 
         var matchesNewCatName = OldText.match(REGEXP_NEW);
 
         var matchesNewCatName = OldText.match(REGEXP_NEW);
         if( ((matchesNewCatName == null)||(OldCatNameUnsorted==NewCatNameUnsorted)) && matchesOldCatName != null && matchesOldCatName.length == 1) {
+
         if (((matchesNewCatName == null) || (OldCatNameUnsorted == NewCatNameUnsorted)) && matchesOldCatName != null && matchesOldCatName.length == 1) {
             OldText = OldText.replace(REGEXP_OLD, "$1[[" + hotcat_CatNamespace+NewCatName + "$6]]");
+
             OldText = OldText.replace(REGEXP_OLD, "$1[[" + hotcat_CatNamespace + NewCatName + "$6]]");
             summary.push ( " ± [["+hotcat_CatNamespace+OldCatNameUnsorted+"]]->[["+hotcat_CatNamespace+ NewCatNameUnsorted+"]]");
+
             summary.push(" ± [[" + hotcat_CatNamespace + OldCatNameUnsorted + "]]->[[" + hotcat_CatNamespace + NewCatNameUnsorted + "]]");
         }else{
+
         } else {
 
             prevent_autocommit = 1;
 
             prevent_autocommit = 1;
             if(matchesOldCatName == null){
+
             if (matchesOldCatName == null) {
 
                 alert(hotcat_text_AlertProblem1.split('$1').join(OldCatNameUnsorted));
 
                 alert(hotcat_text_AlertProblem1.split('$1').join(OldCatNameUnsorted));
             }else if(matchesOldCatName.length > 1){
+
             } else if (matchesOldCatName.length > 1) {
 
                 alert(hotcat_text_AlertProblem3.split('$1').join(OldCatNameUnsorted));
 
                 alert(hotcat_text_AlertProblem3.split('$1').join(OldCatNameUnsorted));
             }else if((matchesNewCatName != null)&&(OldCatNameUnsorted!=NewCatNameUnsorted)){
+
             } else if ((matchesNewCatName != null) && (OldCatNameUnsorted != NewCatNameUnsorted)) {
 
                 alert(hotcat_text_AlertProblem2.split('$1').join(NewCatNameUnsorted));
 
                 alert(hotcat_text_AlertProblem2.split('$1').join(NewCatNameUnsorted));
 
             }
 
             }
 
         }
 
         }
 
     }
 
     }
     if((AddedCategories[0])&&(ModifiedCategories_from[0])) summary.push(" |");
+
     if ((AddedCategories[0]) && (ModifiedCategories_from[0])) summary.push(" |");
     for(var a=0;a<AddedCategories.length;a++){
+
     for (var a = 0; a < AddedCategories.length; a++) {
 
         var NewCatName = AddedCategories[a];
 
         var NewCatName = AddedCategories[a];
 
         var NewCatNameUnsorted = NewCatName.replace(/\|.*/, "");
 
         var NewCatNameUnsorted = NewCatName.replace(/\|.*/, "");
 
         var REGEXP = hotcat_CreateRegExp(NewCatNameUnsorted);
 
         var REGEXP = hotcat_CreateRegExp(NewCatNameUnsorted);
 
         var matchesCatNameUnsorted = OldText.match(REGEXP);
 
         var matchesCatNameUnsorted = OldText.match(REGEXP);
         if (matchesCatNameUnsorted != null){
+
         if (matchesCatNameUnsorted != null) {
 
             alert(hotcat_text_AlertProblem2.split('$1').join(NewCatNameUnsorted));
 
             alert(hotcat_text_AlertProblem2.split('$1').join(NewCatNameUnsorted));
 
             prevent_autocommit = 1;
 
             prevent_autocommit = 1;
 
             continue;
 
             continue;
 
         }
 
         }
         var re = new RegExp("\\[\\[(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category):[^\\]]+\\]\\]", "ig")
+
         var re = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig")
 
         var index = -1;
 
         var index = -1;
 
         while (re.exec(OldText) != null) index = re.lastIndex;
 
         while (re.exec(OldText) != null) index = re.lastIndex;
         var txt = "[[" + hotcat_CatNamespace+NewCatName + "]]" ;
+
         var txt = "[[" + hotcat_CatNamespace + NewCatName + "]]";
         if (index < 0) { // no category
+
         if (index < 0) { // no category
 
             var interWiki = new RegExp('^\\s*\\[\\[([a-z][a-z].?(x?-[^\\]]+)?|simple|tokipona):([^\\]]*)\\]\\]\\s*$');
 
             var interWiki = new RegExp('^\\s*\\[\\[([a-z][a-z].?(x?-[^\\]]+)?|simple|tokipona):([^\\]]*)\\]\\]\\s*$');
 
             var blank = new RegExp('^\\s*$');
 
             var blank = new RegExp('^\\s*$');
Ligne 1 455 : Ligne 1 463 :
 
             var DebutModele = '';
 
             var DebutModele = '';
 
             var SuiteModele = '';
 
             var SuiteModele = '';
             for (var lineId = lines.length - 1; lineId >= 0; --lineId){
+
             for (var lineId = lines.length - 1; lineId >= 0; --lineId) {
 
                 if (!interWiki.test(lines[lineId]) && !blank.test(lines[lineId])) {
 
                 if (!interWiki.test(lines[lineId]) && !blank.test(lines[lineId])) {
 
                     DebutModele = lines.slice(0, lineId + 1).join('\n') + '\n\n';
 
                     DebutModele = lines.slice(0, lineId + 1).join('\n') + '\n\n';
Ligne 1 466 : Ligne 1 474 :
 
                 SuiteModele = OldText;
 
                 SuiteModele = OldText;
 
             }
 
             }
             while(SuiteModele.indexOf('\n\n')!=-1){
+
             while (SuiteModele.indexOf('\n\n') != -1) {
 
                 SuiteModele = SuiteModele.split("\n\n").join("\n");
 
                 SuiteModele = SuiteModele.split("\n\n").join("\n");
 
             }
 
             }
 
             SuiteModele = SuiteModele.replace(/^\n/, "");
 
             SuiteModele = SuiteModele.replace(/^\n/, "");
 
             OldText = DebutModele + txt + '\n\n' + SuiteModele;
 
             OldText = DebutModele + txt + '\n\n' + SuiteModele;
         }else{
+
         } else {
 
             OldText = OldText.substring(0, index) + '\n' + txt + OldText.substring(index);
 
             OldText = OldText.substring(0, index) + '\n' + txt + OldText.substring(index);
 
         }
 
         }
         summary.push ( " + [[" + hotcat_CatNamespace+NewCatNameUnsorted + "]]" ) ;
+
         summary.push(" + [[" + hotcat_CatNamespace + NewCatNameUnsorted + "]]");
 
     }
 
     }
     if((DefaultSort!=hotcat_OldDefaultSort)&&(DefaultSort!="undefined")){
+
     if ((DefaultSort != hotcat_OldDefaultSort) && (DefaultSort != "undefined")) {
         var NewDefaultSort = "{{DEFAULTSORT:"+DefaultSort+"}}\n";
+
         var NewDefaultSort = "{{DEFAULTSORT:" + DefaultSort + "}}\n";
 
         var HasDefaultSort = null;
 
         var HasDefaultSort = null;
         for(var d=0;d<hotcat_DefaultsortAliases.length;d++){
+
         for (var d = 0; d < hotcat_DefaultsortAliases.length; d++) {
             if(OldText.indexOf(hotcat_DefaultsortAliases[d])!=-1) HasDefaultSort = hotcat_DefaultsortAliases[d]+":";
+
             if (OldText.indexOf(hotcat_DefaultsortAliases[d]) != -1) HasDefaultSort = hotcat_DefaultsortAliases[d] + ":";
 
         }
 
         }
         if(HasDefaultSort!=null){
+
         if (HasDefaultSort != null) {
             if(DefaultSort==""){
+
             if (DefaultSort == "") {
 
                 NewDefaultSort = "";
 
                 NewDefaultSort = "";
                 summary.push (";  – {{DEFAULTSORT:" + hotcat_OldDefaultSort +"}}") ;
+
                 summary.push(";  – {{DEFAULTSORT:" + hotcat_OldDefaultSort + "}}");
             }else{
+
             } else {
                 summary.push (";  ± {{DEFAULTSORT:}} : " + hotcat_OldDefaultSort + " -> " + DefaultSort ) ;
+
                 summary.push(";  ± {{DEFAULTSORT:}} : " + hotcat_OldDefaultSort + " -> " + DefaultSort);
 
             }
 
             }
             OldText = OldText.split("{{"+HasDefaultSort+hotcat_OldDefaultSort+"}}\n").join(NewDefaultSort);
+
             OldText = OldText.split("{{" + HasDefaultSort + hotcat_OldDefaultSort + "}}\n").join(NewDefaultSort);
             OldText = OldText.split("{{"+HasDefaultSort+hotcat_OldDefaultSort+"}}").join(NewDefaultSort);
+
             OldText = OldText.split("{{" + HasDefaultSort + hotcat_OldDefaultSort + "}}").join(NewDefaultSort);
         }else if(DefaultSort!=""){
+
         } else if (DefaultSort != "") {
             var re = new RegExp("\\[\\[(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category):[^\\]]+\\]\\]", "ig");
+
             var re = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig");
 
             var index = re.exec(OldText);
 
             var index = re.exec(OldText);
             if(index ==null ) {
+
             if (index == null) {
 
                 var interWiki = new RegExp('^\\s*\\[\\[([a-z][a-z].?(x?-[^\\]]+)?|simple|tokipona):([^\\]]*)\\]\\]\\s*$');
 
                 var interWiki = new RegExp('^\\s*\\[\\[([a-z][a-z].?(x?-[^\\]]+)?|simple|tokipona):([^\\]]*)\\]\\]\\s*$');
 
                 var blank = new RegExp('^\\s*$');
 
                 var blank = new RegExp('^\\s*$');
Ligne 1 500 : Ligne 1 508 :
 
                 var DebutModele = '';
 
                 var DebutModele = '';
 
                 var SuiteModele = '';
 
                 var SuiteModele = '';
                 for (var lineId = lines.length - 1; lineId >= 0; --lineId){
+
                 for (var lineId = lines.length - 1; lineId >= 0; --lineId) {
 
                     if (!interWiki.test(lines[lineId]) && !blank.test(lines[lineId])) {
 
                     if (!interWiki.test(lines[lineId]) && !blank.test(lines[lineId])) {
 
                         DebutModele = lines.slice(0, lineId + 1).join('\n') + '\n\n';
 
                         DebutModele = lines.slice(0, lineId + 1).join('\n') + '\n\n';
Ligne 1 513 : Ligne 1 521 :
 
                 SuiteModele = SuiteModele.replace(/^\n/, "");
 
                 SuiteModele = SuiteModele.replace(/^\n/, "");
 
                 OldText = DebutModele + NewDefaultSort + '\n' + SuiteModele;
 
                 OldText = DebutModele + NewDefaultSort + '\n' + SuiteModele;
             }else{
+
             } else {
 
                 var lastindex = (re.lastIndex);
 
                 var lastindex = (re.lastIndex);
 
                 var compile = re.compile(re);
 
                 var compile = re.compile(re);
Ligne 1 519 : Ligne 1 527 :
 
                 FirstCat = FirstCat.replace(/\n/g, "");
 
                 FirstCat = FirstCat.replace(/\n/g, "");
 
                 var Before = OldText.substring(0, lastindex).replace(FirstCat, "");
 
                 var Before = OldText.substring(0, lastindex).replace(FirstCat, "");
                 var After = FirstCat+OldText.substring(lastindex);
+
                 var After = FirstCat + OldText.substring(lastindex);
 
                 OldText = Before + NewDefaultSort + After;
 
                 OldText = Before + NewDefaultSort + After;
 
             }
 
             }
             summary.push (";  + " + NewDefaultSort ) ;
+
             summary.push(";  + " + NewDefaultSort);
 
         }
 
         }
 
     }
 
     }
     var cat = new RegExp("\\[\\[(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category):[^\\]]+\\]\\]", "ig");
+
     var cat = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig");
     var nocat1 = "{{"+hotcat_text_NoCatTemplate.ucFirst()+"}}\n";
+
     var nocat1 = "{{" + hotcat_text_NoCatTemplate.ucFirst() + "}}\n";
     var nocat1Bis = "{{"+hotcat_text_NoCatTemplate.lcFirst()+"}}\n";
+
     var nocat1Bis = "{{" + hotcat_text_NoCatTemplate.lcFirst() + "}}\n";
     var nocat2 = "{{"+hotcat_text_NoCatTemplate.ucFirst()+"}}";
+
     var nocat2 = "{{" + hotcat_text_NoCatTemplate.ucFirst() + "}}";
     var nocat2Bis = "{{"+hotcat_text_NoCatTemplate.lcFirst()+"}}";
+
     var nocat2Bis = "{{" + hotcat_text_NoCatTemplate.lcFirst() + "}}";
     if(cat.exec(OldText) != null){
+
     if (cat.exec(OldText) != null) {
 
         OldText = OldText.split(nocat1).join("");
 
         OldText = OldText.split(nocat1).join("");
 
         OldText = OldText.split(nocat1Bis).join("");
 
         OldText = OldText.split(nocat1Bis).join("");
Ligne 1 538 : Ligne 1 546 :
 
     document.getElementById('wpTextbox1').value = OldText;
 
     document.getElementById('wpTextbox1').value = OldText;
 
     document.getElementById('wpSummary').value = hotcat_text_ResumeScript + summary.join("");
 
     document.getElementById('wpSummary').value = hotcat_text_ResumeScript + summary.join("");
     if(!hotcat_Multi_IsEditPage){
+
     if (!hotcat_Multi_IsEditPage) {
         if(hotcat_Minoredit==1) document.editform.wpMinoredit.checked = true;
+
         if (hotcat_Minoredit == 1) document.editform.wpMinoredit.checked = true;
         if(hotcat_Minoredit==0) document.editform.wpMinoredit.checked = false;
+
         if (hotcat_Minoredit == 0) document.editform.wpMinoredit.checked = false;
         if(hotcat_Watchthis==1) document.editform.wpWatchthis.checked = true;
+
         if (hotcat_Watchthis == 1) document.editform.wpWatchthis.checked = true;
         if(hotcat_Watchthis==0) document.editform.wpWatchthis.checked = false;
+
         if (hotcat_Watchthis == 0) document.editform.wpWatchthis.checked = false;
 
     }
 
     }
     if((hotcat_autocommit)&&(prevent_autocommit != 1)){
+
     if ((hotcat_autocommit) && (prevent_autocommit != 1)) {
 
         var watchthisparam = {};
 
         var watchthisparam = {};
 
         watchthisparam[-1] = "nochange";
 
         watchthisparam[-1] = "nochange";
         watchthisparam[ 0] = "unwatch";
+
         watchthisparam[0] = "unwatch";
         watchthisparam[ 1] = "watch";
+
         watchthisparam[1] = "watch";
 
         var datas = {
 
         var datas = {
              action   : 'edit',
+
            action: 'edit',
              title     : mw.config.get('wgPageName'),
+
            title: mw.config.get('wgPageName'),
              text     : OldText,
+
            text: OldText,
              summary   : hotcat_text_ResumeScript + summary.join(""),
+
            summary: hotcat_text_ResumeScript + summary.join(""),
              watchlist : watchthisparam[hotcat_Watchthis],
+
            watchlist: watchthisparam[hotcat_Watchthis],
              token     : document.editform.wpEditToken.value
+
            token: document.editform.wpEditToken.value
 
         };
 
         };
         if(document.editform.wpMinoredit.checked){
+
         if (document.editform.wpMinoredit.checked) {
 
             datas['minor'] = 1;
 
             datas['minor'] = 1;
 
         }
 
         }
 
         var hotcattag = hotcat_gettag();
 
         var hotcattag = hotcat_gettag();
         if(hotcattag){
+
         if (hotcattag) {
 
             datas.summary = summary.join("");
 
             datas.summary = summary.join("");
 
             datas.tags = hotcattag;
 
             datas.tags = hotcattag;
 
         }
 
         }
 
         var api = new mw.Api();
 
         var api = new mw.Api();
         api.post( datas, {'contentType':'application/x-www-form-urlencoded'} ).then( function ( data ) {
+
         api.post(datas, {
                  window.location.reload();
+
            'contentType': 'application/x-www-form-urlencoded'
 +
        }).then(function(data) {
 +
            window.location.reload();
 
         });
 
         });
 
         return;
 
         return;
 
     }
 
     }
     if(prevent_autocommit == 1) document.editform.style.display = "";
+
     if (prevent_autocommit == 1) document.editform.style.display = "";
     if(hotcat_Multi_IsEditPage) hotcat_update_existing();
+
     if (hotcat_Multi_IsEditPage) hotcat_update_existing();
 
};
 
};
  
Ligne 1 579 : Ligne 1 589 :
 
// REQUÊTE DE SUGGESTIONS
 
// REQUÊTE DE SUGGESTIONS
  
window.hotcat_text_changed = function(FormIndex, Mode, titles, catContinue) {
+
window.hotcat_text_changed = function(FormIndex, Mode, titles, catContinue) {
     if ( hotcat_suggest_running ) return ;
+
     if (hotcat_suggest_running) return;
     if(!Mode) Mode = false;
+
     if (!Mode) Mode = false;
     if((!FormIndex)||(FormIndex=="")) FormIndex = "0";
+
     if ((!FormIndex) || (FormIndex == "")) FormIndex = "0";
     if(!titles) titles = [];
+
     if (!titles) titles = [];
     if(!catContinue) catContinue = "";
+
     if (!catContinue) catContinue = "";
 
     var text = hotcat_TextMatrix[FormIndex];
 
     var text = hotcat_TextMatrix[FormIndex];
     if(!text){alert('PB hotcat_text_changed () : ' + FormIndex); return; }
+
     if (!text) {
 +
        alert('PB hotcat_text_changed () : ' + FormIndex);
 +
        return;
 +
    }
 
     var v = text.value;
 
     var v = text.value;
 
     v = hotcat_deleteUnwantedUnicodeChars(v);
 
     v = hotcat_deleteUnwantedUnicodeChars(v);
     v = v.replace(new RegExp("^"+hotcat_CatNamespace, "ig"), "");
+
     v = v.replace(new RegExp("^" + hotcat_CatNamespace, "ig"), "");
     v = v.ucFirst() ;
+
     v = v.ucFirst();
 
     text.value = v;
 
     text.value = v;
     if(v.indexOf("|")!=-1) v = v.split("|")[0];
+
     if (v.indexOf("|") != -1) v = v.split("|")[0];
     var APILimit = ( ((mw.config.get('wgUserGroups').indexOf("sysop")!=-1)||(mw.config.get('wgUserGroups').indexOf("bot")!=-1)) ? 4999 : 499 );
+
     var APILimit = (((mw.config.get('wgUserGroups').indexOf("sysop") != -1) || (mw.config.get('wgUserGroups').indexOf("bot") != -1)) ? 4999 : 499);
     if(hotcat_list_items>APILimit) hotcat_list_items = APILimit; // API max
+
     if (hotcat_list_items > APILimit) hotcat_list_items = APILimit; // API max
     if(Mode=="UP"){ // Suggestions catégories-mères
+
     if (Mode == "UP") { // Suggestions catégories-mères
         var URL = "/api.php?format=xml&action=query&prop=categories&titles=" + hotcat_CatNamespace+encodeURIComponent(v) + "&cllimit=" + hotcat_list_items;
+
         var URL = "/api.php?format=xml&action=query&prop=categories&titles=" + hotcat_CatNamespace + encodeURIComponent(v) + "&cllimit=" + hotcat_list_items;
 
         var TagName = "cl";
 
         var TagName = "cl";
 
         var Replace = false;
 
         var Replace = false;
     }else if(Mode=="DOWN"){ // Suggestions catégories-filles
+
     } else if (Mode == "DOWN") { // Suggestions catégories-filles
         var URL = "/api.php?format=xml&action=query&list=categorymembers&cmnamespace=14&cmtitle=" + hotcat_CatNamespace+encodeURIComponent(v) + "&cmlimit=" + APILimit + catContinue;
+
         var URL = "/api.php?format=xml&action=query&list=categorymembers&cmnamespace=14&cmtitle=" + hotcat_CatNamespace + encodeURIComponent(v) + "&cmlimit=" + APILimit + catContinue;
 
         var TagName = "cm";
 
         var TagName = "cm";
 
         var Replace = false;
 
         var Replace = false;
     }else{ // Suggestions normales
+
     } else { // Suggestions normales
         var URL = "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent(v) + "&aplimit=" + hotcat_list_items;
+
         var URL = "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent(v) + "&aplimit=" + hotcat_list_items;
 
         var TagName = "p";
 
         var TagName = "p";
 
         var Replace = true;
 
         var Replace = true;
 
     }
 
     }
     hotcat_suggest_running = 1 ;
+
     hotcat_suggest_running = 1;
     if ( v != "" ) {
+
     if (v != "") {
         hotcat_ajax.http({url         : mw.config.get('wgServer') + mw.config.get('wgScriptPath') + URL,
+
         hotcat_ajax.http({
                          onSuccess   : hotcat_text_changedBis,
+
            url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + URL,
                          tagname     : TagName,
+
            onSuccess: hotcat_text_changedBis,
                          replacetext : Replace,
+
            tagname: TagName,
                          titles     : titles,
+
            replacetext: Replace,
                          formindex   : FormIndex,
+
            titles: titles,
                          mode       : Mode
+
            formindex: FormIndex,
 +
            mode: Mode
 
         });
 
         });
     }else{
+
     } else {
         hotcat_show_suggestions ( titles , FormIndex, Replace ) ;
+
         hotcat_show_suggestions(titles, FormIndex, Replace);
 
     }
 
     }
 
};
 
};
  
window.hotcat_text_changedBis = function(Req, data){
+
window.hotcat_text_changedBis = function(Req, data) {
 
     var titles = data.titles;
 
     var titles = data.titles;
 
     var FormIndex = data.formindex;
 
     var FormIndex = data.formindex;
Ligne 1 629 : Ligne 1 643 :
 
     var TagName = data.tagname;
 
     var TagName = data.tagname;
 
     var Replace = data.replacetext;
 
     var Replace = data.replacetext;
     var xml = Req.responseXML ;
+
     var xml = Req.responseXML;
     if ( xml == null ) return ;
+
     if (xml == null) return;
     var pages = xml.getElementsByTagName( TagName ) ;
+
     var pages = xml.getElementsByTagName(TagName);
     for ( var i = 0 ; i < pages.length ; i++ ) {
+
     for (var i = 0; i < pages.length; i++) {
 
         var s = pages[i].getAttribute("title");
 
         var s = pages[i].getAttribute("title");
         if(s.indexOf(hotcat_CatNamespace)!=-1){
+
         if (s.indexOf(hotcat_CatNamespace) != -1) {
 
             s = s.split(hotcat_CatNamespace).join('');
 
             s = s.split(hotcat_CatNamespace).join('');
             titles.push ( s ) ;
+
             titles.push(s);
 
         }
 
         }
 
     }
 
     }
 
     var CanContinue = xml.getElementsByTagName("query-continue")[0];
 
     var CanContinue = xml.getElementsByTagName("query-continue")[0];
     if(Mode=="DOWN"&&CanContinue){
+
     if (Mode == "DOWN" && CanContinue) {
         CanContinueId = "&cmcontinue="+encodeURIComponent(CanContinue.firstChild.getAttribute("cmcontinue"));
+
         CanContinueId = "&cmcontinue=" + encodeURIComponent(CanContinue.firstChild.getAttribute("cmcontinue"));
         hotcat_suggest_running = 0 ;
+
         hotcat_suggest_running = 0;
         hotcat_text_changed(FormIndex, Mode, titles, CanContinueId) ;
+
         hotcat_text_changed(FormIndex, Mode, titles, CanContinueId);
     }else{
+
     } else {
 
         hotcat_show_suggestions(titles, FormIndex, Replace);
 
         hotcat_show_suggestions(titles, FormIndex, Replace);
 
     }
 
     }
Ligne 1 651 : Ligne 1 665 :
 
// AFFICHAGE DES SUGGESTIONS
 
// AFFICHAGE DES SUGGESTIONS
  
window.hotcat_show_suggestions = function( titles, FormIndex, Replace, Mode ) {
+
window.hotcat_show_suggestions = function(titles, FormIndex, Replace, Mode) {
     hotcat_suggest_running = 0 ;
+
     hotcat_suggest_running = 0;
     var text = hotcat_TextMatrix[FormIndex] ;
+
     var text = hotcat_TextMatrix[FormIndex];
     var list = hotcat_ListMatrix[FormIndex] ;
+
     var list = hotcat_ListMatrix[FormIndex];
     var icon = hotcat_ExistMatrix[FormIndex] ;
+
     var icon = hotcat_ExistMatrix[FormIndex];
     if((!text)||(!list)||(!icon)) { alert('PB hotcat_show_suggestions() : ' + FormIndex); return; }
+
     if ((!text) || (!list) || (!icon)) {
     if(titles.length==0){
+
        alert('PB hotcat_show_suggestions() : ' + FormIndex);
         list.style.display = "none" ;
+
        return;
         if(Replace){
+
    }
             icon.src = hotcat_exists_no ;
+
     if (titles.length == 0) {
             icon.title = hotcat_text_Exists_NoTitle ;
+
         list.style.display = "none";
 +
         if (Replace) {
 +
             icon.src = hotcat_exists_no;
 +
             icon.title = hotcat_text_Exists_NoTitle;
 
         }
 
         }
         return ;
+
         return;
 
     }
 
     }
 
     var TailleListe = hotcat_list_size;
 
     var TailleListe = hotcat_list_size;
     if (titles.length < TailleListe ) TailleListe = titles.length;
+
     if (titles.length < TailleListe) TailleListe = titles.length;
     var listh = TailleListe * 20 ;
+
     var listh = TailleListe * 20;
     list.size = 5 ;
+
     list.size = 5;
     list.style.align = "left" ;
+
     list.style.align = "left";
 
     list.style.zIndex = 5;
 
     list.style.zIndex = 5;
     list.style.position = "relative" ;
+
     list.style.position = "relative";
     list.style.width = text.offsetWidth + "px" ;
+
     list.style.width = text.offsetWidth + "px";
     list.style.height = listh + "px" ;
+
     list.style.height = listh + "px";
     while ( list.firstChild ) list.removeChild ( list.firstChild ) ;
+
     while (list.firstChild) list.removeChild(list.firstChild);
     for ( var i = 0 ; i < titles.length ; i++ ) {
+
     for (var i = 0; i < titles.length; i++) {
         var opt = document.createElement ( "option" ) ;
+
         var opt = document.createElement("option");
         var ot = document.createTextNode ( titles[i] ) ;
+
         var ot = document.createTextNode(titles[i]);
         opt.appendChild ( ot ) ;
+
         opt.appendChild(ot);
 
         opt.value = titles[i];
 
         opt.value = titles[i];
         list.appendChild ( opt ) ;
+
         list.appendChild(opt);
 
     }
 
     }
     if(hotcat_list_down){
+
     if (hotcat_list_down) {
 
         list.style.top = parseInt(text.offsetHeight) + "px";
 
         list.style.top = parseInt(text.offsetHeight) + "px";
         list.style.marginBottom = "-" + (listh + parseInt(text.offsetHeight)) + "px" ;
+
         list.style.marginBottom = "-" + (listh + parseInt(text.offsetHeight)) + "px";
     }else{
+
     } else {
         list.style.marginTop = "-" + listh + "px" ;
+
         list.style.marginTop = "-" + listh + "px";
         list.style.display = "inline" ;
+
         list.style.display = "inline";
         $(list).position({my: "left bottom", at: "left top", collision: "none", of: $(text)});
+
         $(list).position({
 +
            my: "left bottom",
 +
            at: "left top",
 +
            collision: "none",
 +
            of: $(text)
 +
        });
 
     }
 
     }
     list.style.marginLeft = "-" + text.offsetWidth + "px" ;
+
     list.style.marginLeft = "-" + text.offsetWidth + "px";
 
     list.onkeyup = hotcat_KeypressedOnList;
 
     list.onkeyup = hotcat_KeypressedOnList;
     list.style.display = "inline" ;
+
     list.style.display = "inline";
     icon.title = hotcat_text_Exists_YesTitle ;
+
     icon.title = hotcat_text_Exists_YesTitle;
     icon.src = hotcat_exists_yes ;
+
     icon.src = hotcat_exists_yes;
     var first_title = titles.shift () ;
+
     var first_title = titles.shift();
 
     hotcat_last_v = text.value.ucFirst();
 
     hotcat_last_v = text.value.ucFirst();
 
     var hotcat_last_v_Split = hotcat_last_v;
 
     var hotcat_last_v_Split = hotcat_last_v;
     if(hotcat_last_v.indexOf('|')!=-1){
+
     if (hotcat_last_v.indexOf('|') != -1) {
      hotcat_last_key = hotcat_last_v.substring(hotcat_last_v.indexOf("|"), hotcat_last_v.length);
+
        hotcat_last_key = hotcat_last_v.substring(hotcat_last_v.indexOf("|"), hotcat_last_v.length);
      hotcat_last_v_Split = hotcat_last_v.split(hotcat_last_key).join('');
+
        hotcat_last_v_Split = hotcat_last_v.split(hotcat_last_key).join('');
     }else{
+
     } else {
      hotcat_last_key = "";
+
        hotcat_last_key = "";
 
     }
 
     }
     if ( first_title == hotcat_last_v_Split ) return ;
+
     if (first_title == hotcat_last_v_Split) return;
     if(Replace){
+
     if (Replace) {
 
         var suggestion = first_title;
 
         var suggestion = first_title;
         if(suggestion.indexOf(hotcat_last_v_Split)==-1){
+
         if (suggestion.indexOf(hotcat_last_v_Split) == -1) {
             icon.src = hotcat_exists_no ;
+
             icon.src = hotcat_exists_no;
             icon.title = hotcat_text_Exists_NoTitle ;
+
             icon.title = hotcat_text_Exists_NoTitle;
 
             return;
 
             return;
 
         }
 
         }
         text.value = suggestion + hotcat_last_key ;
+
         text.value = suggestion + hotcat_last_key;
 
         if (text.createTextRange) {
 
         if (text.createTextRange) {
 
             var ra = text.createTextRange();
 
             var ra = text.createTextRange();
Ligne 1 718 : Ligne 1 740 :
 
             ra.moveEnd("character", suggestion.length);
 
             ra.moveEnd("character", suggestion.length);
 
             ra.select();
 
             ra.select();
         } else if( text.setSelectionRange ) {
+
         } else if (text.setSelectionRange) {
             text.setSelectionRange( hotcat_last_v.length, suggestion.length );
+
             text.setSelectionRange(hotcat_last_v.length, suggestion.length);
 
         } else {
 
         } else {
             text.selectionStart = hotcat_last_v.length ;
+
             text.selectionStart = hotcat_last_v.length;
             text.selectionEnd = suggestion.length ;
+
             text.selectionEnd = suggestion.length;
 
         }
 
         }
     }else{
+
     } else {
 
         list.focus();
 
         list.focus();
 
     }
 
     }
Ligne 1 731 : Ligne 1 753 :
 
// MISE A JOUR DE LA POSITION DES LISTES DE SUGGESTIONS
 
// MISE A JOUR DE LA POSITION DES LISTES DE SUGGESTIONS
  
window.hotcat_upDate_FormPositions = function(){
+
window.hotcat_upDate_FormPositions = function() {
 
     var AllForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
 
     var AllForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
     for(var a=0;a<AllForms.length;a++){
+
     for (var a = 0; a < AllForms.length; a++) {
         if(AllForms[a].id == "hotcat_modify_multi_form") continue;
+
         if (AllForms[a].id == "hotcat_modify_multi_form") continue;
         if(AllForms[a].id == "hotcat_form_Default") continue;
+
         if (AllForms[a].id == "hotcat_form_Default") continue;
 
         var ThisForm = AllForms[a];
 
         var ThisForm = AllForms[a];
 
         var ThisSelect = ThisForm.getElementsByTagName('select')[0];
 
         var ThisSelect = ThisForm.getElementsByTagName('select')[0];
 
         var Options = ThisSelect.getElementsByTagName('option');
 
         var Options = ThisSelect.getElementsByTagName('option');
 
         var ThisInput = ThisForm.getElementsByTagName('input')[0];
 
         var ThisInput = ThisForm.getElementsByTagName('input')[0];
         var ListHeight = hotcat_list_size * 20 ;
+
         var ListHeight = hotcat_list_size * 20;
 
         if (Options.length < hotcat_list_size) {
 
         if (Options.length < hotcat_list_size) {
             ListHeight = Options.length * 20 ;
+
             ListHeight = Options.length * 20;
 
         }
 
         }
         if(hotcat_list_down){
+
         if (hotcat_list_down) {
 
             ThisSelect.style.top = parseInt(ThisInput.offsetHeight) + "px";
 
             ThisSelect.style.top = parseInt(ThisInput.offsetHeight) + "px";
             ThisSelect.style.marginBottom = "-" + (ListHeight + parseInt(ThisInput.offsetHeight)) + "px" ;
+
             ThisSelect.style.marginBottom = "-" + (ListHeight + parseInt(ThisInput.offsetHeight)) + "px";
         }else{
+
         } else {
             ThisSelect.style.marginTop = "-" + ListHeight + "px" ;
+
             ThisSelect.style.marginTop = "-" + ListHeight + "px";
 
         }
 
         }
         ThisSelect.style.marginLeft = "-" + ThisInput.offsetWidth + "px" ;
+
         ThisSelect.style.marginLeft = "-" + ThisInput.offsetWidth + "px";
 
     }
 
     }
 
};
 
};
Ligne 1 756 : Ligne 1 778 :
 
// SÉLECTION D'UNE SUGGESTION AU CLAVIER
 
// SÉLECTION D'UNE SUGGESTION AU CLAVIER
  
window.hotcat_KeypressedOnList = function(e){
+
window.hotcat_KeypressedOnList = function(e) {
 
     if (!e) var e = window.event;
 
     if (!e) var e = window.event;
 
     if (e.keyCode != 13) return;
 
     if (e.keyCode != 13) return;
Ligne 1 764 : Ligne 1 786 :
 
// REMPLACEMENT DU CHAMP DE TEXTE PAR UNE SUGGESTION
 
// REMPLACEMENT DU CHAMP DE TEXTE PAR UNE SUGGESTION
  
window.hotcat_text_replace = function(Index){
+
window.hotcat_text_replace = function(Index) {
 
     var Text = hotcat_TextMatrix[Index];
 
     var Text = hotcat_TextMatrix[Index];
 
     var TextValue = Text.value;
 
     var TextValue = Text.value;
 
     var List = hotcat_ListMatrix[Index];
 
     var List = hotcat_ListMatrix[Index];
 
     var Options = List.getElementsByTagName('option');
 
     var Options = List.getElementsByTagName('option');
     for(var a=0;a<Options.length;a++){
+
     for (var a = 0; a < Options.length; a++) {
         if(Options[a].selected){
+
         if (Options[a].selected) {
 
             var ListValue = Options[a].value;
 
             var ListValue = Options[a].value;
             if(TextValue.indexOf('|')!=-1){
+
             if (TextValue.indexOf('|') != -1) {
 
                 hotcat_last_key = TextValue.substring(TextValue.indexOf("|"), TextValue.length);
 
                 hotcat_last_key = TextValue.substring(TextValue.indexOf("|"), TextValue.length);
 
             }
 
             }
 
             Text.value = ListValue + hotcat_last_key;
 
             Text.value = ListValue + hotcat_last_key;
             hotcat_text_changed(Index) ;
+
             hotcat_text_changed(Index);
 
             Text.focus();
 
             Text.focus();
 
             return;
 
             return;
Ligne 1 785 : Ligne 1 807 :
 
///////////////////////// MISE A JOUR BARRE DE CATÉGORIES ////////////////////////////////////////////////////////
 
///////////////////////// MISE A JOUR BARRE DE CATÉGORIES ////////////////////////////////////////////////////////
  
window.hotcat_update_existing = function(){
+
window.hotcat_update_existing = function() {
 
     var OldText = document.getElementById("wpTextbox1").value;
 
     var OldText = document.getElementById("wpTextbox1").value;
 
     OldText = hotcat_update_existing_Strip(OldText);
 
     OldText = hotcat_update_existing_Strip(OldText);
     var catRegExp = new RegExp("\\[\\[(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category):[^\\]]+\\]\\]", "ig");
+
     var catRegExp = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig");
 
     var Matches = OldText.match(catRegExp);
 
     var Matches = OldText.match(catRegExp);
 
     var Cats = [];
 
     var Cats = [];
     if(Matches != null){
+
     if (Matches != null) {
         for(var a=0,l=Matches.length;a<l;a++){
+
         for (var a = 0, l = Matches.length; a < l; a++) {
 
             var ThisMatch = Matches[a];
 
             var ThisMatch = Matches[a];
             ThisMatch = ThisMatch.replace(new RegExp("\\[\\[(" + mw.config.get('wgFormattedNamespaces')[14]+"|Category):", "ig"), "");
+
             ThisMatch = ThisMatch.replace(new RegExp("\\[\\[(" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):", "ig"), "");
 
             ThisMatch = ThisMatch.replace(new RegExp("\\]\\]", "ig"), "");
 
             ThisMatch = ThisMatch.replace(new RegExp("\\]\\]", "ig"), "");
 
             var ThisCat = ThisMatch.replace(/\|.*/g, "");
 
             var ThisCat = ThisMatch.replace(/\|.*/g, "");
Ligne 1 803 : Ligne 1 825 :
 
};
 
};
  
window.hotcat_update_existing_Strip = function(Text){
+
window.hotcat_update_existing_Strip = function(Text) {
  Text = hotcat_update_existing_StripTag(Text, "<nowiki[^>]*>", "</"+"nowiki>");
+
    Text = hotcat_update_existing_StripTag(Text, "<nowiki[^>]*>", "</" + "nowiki>");
  Text = hotcat_update_existing_StripTag(Text, "<includeonly[^>]*>", "</"+"includeonly>");
+
    Text = hotcat_update_existing_StripTag(Text, "<includeonly[^>]*>", "</" + "includeonly>");
  Text = hotcat_update_existing_StripTag(Text, "<pre[ ]+[^>]*>", "</"+"pre>");
+
    Text = hotcat_update_existing_StripTag(Text, "<pre[ ]+[^>]*>", "</" + "pre>");
  Text = hotcat_update_existing_StripTag(Text, "<source[ ]+[^>]*>", "</"+"source>");
+
    Text = hotcat_update_existing_StripTag(Text, "<source[ ]+[^>]*>", "</" + "source>");
  Text = hotcat_update_existing_StripTag(Text, "<syntaxhighlight[ ]*[^>]*>", "</"+"syntaxhighlight>");
+
    Text = hotcat_update_existing_StripTag(Text, "<syntaxhighlight[ ]*[^>]*>", "</" + "syntaxhighlight>");
  Text = hotcat_update_existing_StripTag(Text, "<!--[\\-]*", "-->");
+
    Text = hotcat_update_existing_StripTag(Text, "<!--[\\-]*", "-->");
  return Text;
+
    return Text;
 
};
 
};
  
window.hotcat_update_existing_StripTag = function(Text, StartTag, EndTag){
+
window.hotcat_update_existing_StripTag = function(Text, StartTag, EndTag) {
  var TagRegExp = new RegExp(StartTag, "ig");
+
    var TagRegExp = new RegExp(StartTag, "ig");
  var Matches = Text.match(TagRegExp);
+
    var Matches = Text.match(TagRegExp);
  if(Matches!=null){
+
    if (Matches != null) {
      for(var a=0,l=Matches.length;a<l;a++){
+
        for (var a = 0, l = Matches.length; a < l; a++) {
        var BeforeTag = Text.substring(0, Text.indexOf(Matches[a]));
+
            var BeforeTag = Text.substring(0, Text.indexOf(Matches[a]));
        var AfterTag = Text.substring(BeforeTag.length, Text.length);
+
            var AfterTag = Text.substring(BeforeTag.length, Text.length);
        if(AfterTag.indexOf(EndTag)==-1){
+
            if (AfterTag.indexOf(EndTag) == -1) {
            AfterTag = "";
+
                AfterTag = "";
        }else{
+
            } else {
            AfterTag = AfterTag.substring( (AfterTag.indexOf(EndTag) + (EndTag.length)) , AfterTag.length);
+
                AfterTag = AfterTag.substring((AfterTag.indexOf(EndTag) + (EndTag.length)), AfterTag.length);
        }
+
            }
        Text = BeforeTag + AfterTag;
+
            Text = BeforeTag + AfterTag;
        if(Text.match(TagRegExp)==null) break;
+
            if (Text.match(TagRegExp) == null) break;
      }
+
        }
  }
+
    }
  return Text;
+
    return Text;
 
};
 
};
  
window.hotcat_update_existing_Exists = function(Cats, NewCats){
+
window.hotcat_update_existing_Exists = function(Cats, NewCats) {
     if(!Cats[0]){
+
     if (!Cats[0]) {
 
         hotcat_update_existing_Update(Cats, NewCats);
 
         hotcat_update_existing_Update(Cats, NewCats);
 
         return;
 
         return;
 
     }
 
     }
     if(!NewCats) NewCats = [];
+
     if (!NewCats) NewCats = [];
 
     var CatTitles = [];
 
     var CatTitles = [];
     for(var a=0,l=Cats.length;a<l;a++){ CatTitles.push( mw.config.get('wgFormattedNamespaces')[14]+":"+encodeURIComponent(Cats[a]) ); }
+
     for (var a = 0, l = Cats.length; a < l; a++) {
     var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&titles=' + CatTitles ;
+
        CatTitles.push(mw.config.get('wgFormattedNamespaces')[14] + ":" + encodeURIComponent(Cats[a]));
     hotcat_ajax.http({url         : URL,
+
    }
                      onSuccess   : hotcat_update_existing_ExistsBis,
+
     var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&titles=' + CatTitles;
                      cats       : Cats,
+
     hotcat_ajax.http({
                      newcats     : NewCats
+
         url: URL,
 +
        onSuccess: hotcat_update_existing_ExistsBis,
 +
        cats: Cats,
 +
        newcats: NewCats
 
     });
 
     });
 
};
 
};
  
window.hotcat_update_existing_ExistsBis = function(Req, data){
+
window.hotcat_update_existing_ExistsBis = function(Req, data) {
 
     var Cats = data.cats;
 
     var Cats = data.cats;
 
     var NewCats = data.newcats;
 
     var NewCats = data.newcats;
  
 
     var ObjetXML = Req.responseXML;
 
     var ObjetXML = Req.responseXML;
     if(!ObjetXML){
+
     if (!ObjetXML) {
 
         hotcat_update_existing_Update(Cats, NewCats);
 
         hotcat_update_existing_Update(Cats, NewCats);
 
         return;
 
         return;
 
     }
 
     }
 
     var Pages = ObjetXML.getElementsByTagName('page');
 
     var Pages = ObjetXML.getElementsByTagName('page');
     for(var a=0,l=Pages.length;a<l;a++){
+
     for (var a = 0, l = Pages.length; a < l; a++) {
 
         var Page = Pages[a];
 
         var Page = Pages[a];
 
         var Title = Page.getAttribute("title").split(mw.config.get('wgFormattedNamespaces')[14] + ":").join("");
 
         var Title = Page.getAttribute("title").split(mw.config.get('wgFormattedNamespaces')[14] + ":").join("");
         var Index= Cats.indexOf(Title);
+
         var Index = Cats.indexOf(Title);
         if(Index==-1) continue;
+
         if (Index == -1) continue;
 
         var Missing = Page.getAttribute("missing");
 
         var Missing = Page.getAttribute("missing");
         if(Missing==""){
+
         if (Missing == "") {
 
             NewCats[Index] = true;
 
             NewCats[Index] = true;
         }else{
+
         } else {
 
             NewCats[Index] = false;
 
             NewCats[Index] = false;
 
         }
 
         }
Ligne 1 873 : Ligne 1 898 :
 
};
 
};
  
window.hotcat_update_existing_Update = function(Cats, NewCats){
+
window.hotcat_update_existing_Update = function(Cats, NewCats) {
 
     var CatLine = document.getElementById("mw-normal-catlinks");
 
     var CatLine = document.getElementById("mw-normal-catlinks");
 
     var catline = document.createElement("div");
 
     var catline = document.createElement("div");
Ligne 1 879 : Ligne 1 904 :
 
     CatLine.parentNode.insertBefore(catline, CatLine);
 
     CatLine.parentNode.insertBefore(catline, CatLine);
 
     var plural = (Cats.length != 1);
 
     var plural = (Cats.length != 1);
     hotcat_append_firstlink( catline, plural);
+
     hotcat_append_firstlink(catline, plural);
     for(var a=0,l=Cats.length;a<l;a++){
+
     for (var a = 0, l = Cats.length; a < l; a++) {
 
         var Cat = Cats[a];
 
         var Cat = Cats[a];
         var Link = document.createElement('a');
+
         var Link = document.createElement('a');
 
         Link.title = mw.config.get('wgFormattedNamespaces')[14] + ":" + Cat;
 
         Link.title = mw.config.get('wgFormattedNamespaces')[14] + ":" + Cat;
 
         Link.appendChild(document.createTextNode(Cat));
 
         Link.appendChild(document.createTextNode(Cat));
 
         Link.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(mw.config.get('wgFormattedNamespaces')[14] + ":" + encodeURI(Cat));
 
         Link.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(mw.config.get('wgFormattedNamespaces')[14] + ":" + encodeURI(Cat));
         if(NewCats[a]) Link.className = "new";
+
         if (NewCats[a]) Link.className = "new";
 
         var Span = document.createElement('span');
 
         var Span = document.createElement('span');
 
         Span.appendChild(Link);
 
         Span.appendChild(Link);
         if(a!=0) catline.appendChild(document.createTextNode(' | '));
+
         if (a != 0) catline.appendChild(document.createTextNode(' | '));
 
         catline.appendChild(Span);
 
         catline.appendChild(Span);
 
     }
 
     }
     var HiddenCatsLink = document.getElementById(hotcat_HiddenCatsLinkID);
+
     var HiddenCatsLink = document.getElementById(hotcat_HiddenCatsLinkID);
     if(HiddenCatsLink){
+
     if (HiddenCatsLink) {
      HiddenCatsLink.parentNode.removeChild(HiddenCatsLink);
+
        HiddenCatsLink.parentNode.removeChild(HiddenCatsLink);
      catline.appendChild(document.createTextNode(' | '));
+
        catline.appendChild(document.createTextNode(' | '));
      catline.appendChild(HiddenCatsLink);
+
        catline.appendChild(HiddenCatsLink);
 
     }
 
     }
 
     CatLine.parentNode.removeChild(CatLine);
 
     CatLine.parentNode.removeChild(CatLine);
Ligne 1 909 : Ligne 1 934 :
 
// RÉCUPÉRATION DU N° D'INDEX
 
// RÉCUPÉRATION DU N° D'INDEX
  
window.hotcat_getIndex = function( Element ){
+
window.hotcat_getIndex = function(Element) {
 
     return parseInt(Element.id.replace(/[^0-9]/g, ""));
 
     return parseInt(Element.id.replace(/[^0-9]/g, ""));
 
};
 
};
Ligne 1 915 : Ligne 1 940 :
 
// GESTION {{PLURAL:}} (MESSAGES SYSTÈME)
 
// GESTION {{PLURAL:}} (MESSAGES SYSTÈME)
  
window.hotcat_PLURAL = function(Text, Plural){
+
window.hotcat_PLURAL = function(Text, Plural) {
 
     var PluralRegExp = new RegExp("\\{\\{PLURAL[^\\}]+\\}\\}", "ig");
 
     var PluralRegExp = new RegExp("\\{\\{PLURAL[^\\}]+\\}\\}", "ig");
 
     var Matches = Text.match(PluralRegExp);
 
     var Matches = Text.match(PluralRegExp);
     if(Matches!=null){
+
     if (Matches != null) {
         for(var b=0,m=Matches.length;b<m;b++){
+
         for (var b = 0, m = Matches.length; b < m; b++) {
 
             var Match = Matches[b];
 
             var Match = Matches[b];
 
             var Params = Match.split('}}').join('').split('|');
 
             var Params = Match.split('}}').join('').split('|');
 
             var Result = "";
 
             var Result = "";
             if(Plural){
+
             if (Plural) {
 
                 Result = Params[2];
 
                 Result = Params[2];
             }else{
+
             } else {
 
                 Result = Params[1];
 
                 Result = Params[1];
 
             }
 
             }
             if(!Result) Result = "";
+
             if (!Result) Result = "";
 
             Text = Text.replace(Match, Result);
 
             Text = Text.replace(Match, Result);
 
         }
 
         }
Ligne 1 937 : Ligne 1 962 :
 
// GESTION {{GENDER:}} (MESSAGES SYSTÈME)
 
// GESTION {{GENDER:}} (MESSAGES SYSTÈME)
  
window.hotcat_GENDER = function(Text, Gender){
+
window.hotcat_GENDER = function(Text, Gender) {
 
     var PluralRegExp = new RegExp("\\{\\{GENDER[^\\}]+\\}\\}", "ig");
 
     var PluralRegExp = new RegExp("\\{\\{GENDER[^\\}]+\\}\\}", "ig");
 
     var Matches = Text.match(PluralRegExp);
 
     var Matches = Text.match(PluralRegExp);
     if(Matches!=null){
+
     if (Matches != null) {
         for(var b=0,m=Matches.length;b<m;b++){
+
         for (var b = 0, m = Matches.length; b < m; b++) {
 
             var Match = Matches[b];
 
             var Match = Matches[b];
 
             var Params = Match.split('}}').join('').split('|');
 
             var Params = Match.split('}}').join('').split('|');
 
             var Result = "";
 
             var Result = "";
             if(Gender=="male"){
+
             if (Gender == "male") {
 
                 Result = Params[1];
 
                 Result = Params[1];
             }else if(Gender=="female"){
+
             } else if (Gender == "female") {
 
                 Result = Params[2];
 
                 Result = Params[2];
             }else{
+
             } else {
 
                 Result = Params[3];
 
                 Result = Params[3];
 
             }
 
             }
             if(!Result) Result = "";
+
             if (!Result) Result = "";
 
             Text = Text.replace(Match, Result);
 
             Text = Text.replace(Match, Result);
 
         }
 
         }
Ligne 1 961 : Ligne 1 986 :
 
// PREMIÈRE LETTRE EN MAJUSCULE
 
// PREMIÈRE LETTRE EN MAJUSCULE
  
String.prototype.ucFirst = function () {
+
String.prototype.ucFirst = function() {
     return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
+
     return this.substr(0, 1).toUpperCase() + this.substr(1, this.length);
 
};
 
};
  
 
// PREMIÈRE LETTRE EN MINUSCULE
 
// PREMIÈRE LETTRE EN MINUSCULE
  
String.prototype.lcFirst = function () {
+
String.prototype.lcFirst = function() {
     return this.substr(0,1).toLowerCase() + this.substr(1,this.length);
+
     return this.substr(0, 1).toLowerCase() + this.substr(1, this.length);
 
};
 
};
  
window.hotcat_CreateRegExp = function(Cat){
+
window.hotcat_CreateRegExp = function(Cat) {
     if(hotcat_CaseSensitive){
+
     if (hotcat_CaseSensitive) {
 
         Cat = Cat.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1");
 
         Cat = Cat.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1");
     }else{
+
     } else {
         Cat = "("+ Cat.ucFirst().replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + "|" + Cat.lcFirst().replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + ")";
+
         Cat = "(" + Cat.ucFirst().replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + "|" + Cat.lcFirst().replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + ")";
 
     }
 
     }
     var CatRegExp = new RegExp("(\\s*)\\[\\[( |_)*(?:"+mw.config.get('wgFormattedNamespaces')[14]+"|Category)( |_)*:( |_)*" + Cat +"( |_)*(\\|[^\\]]*)?\\]\\]", "g");
+
     var CatRegExp = new RegExp("(\\s*)\\[\\[( |_)*(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category)( |_)*:( |_)*" + Cat + "( |_)*(\\|[^\\]]*)?\\]\\]", "g");
 
     return CatRegExp;
 
     return CatRegExp;
 
};
 
};
Ligne 1 983 : Ligne 2 008 :
 
// Retrait de caractères unicode indésirables
 
// Retrait de caractères unicode indésirables
  
window.hotcat_deleteUnwantedUnicodeChars = function(Text){
+
window.hotcat_deleteUnwantedUnicodeChars = function(Text) {
  return Text.replace(/\u200E|\u200F|\u202A|\u202B|\u202C|\u202D|\u202E/g, '');
+
    return Text.replace(/\u200E|\u200F|\u202A|\u202B|\u202C|\u202D|\u202E/g, '');
 
};
 
};
  
Ligne 1 990 : Ligne 2 015 :
  
  
window.hotcat_Launch = function(){
+
window.hotcat_Launch = function() {
 
     var hotcat_CanEdit = true;
 
     var hotcat_CanEdit = true;
 
     var RestrictionEdit = mw.config.get('wgRestrictionEdit');
 
     var RestrictionEdit = mw.config.get('wgRestrictionEdit');
 
     var Groups = mw.config.get('wgUserGroups');
 
     var Groups = mw.config.get('wgUserGroups');
     if(RestrictionEdit !== null && typeof(RestrictionEdit)==='object' && RestrictionEdit.length > 0){
+
     if (RestrictionEdit !== null && typeof(RestrictionEdit) === 'object' && RestrictionEdit.length > 0) {
 
         hotcat_CanEdit = false;
 
         hotcat_CanEdit = false;
         if( Groups !== null && typeof(Groups)==='object'){
+
         if (Groups !== null && typeof(Groups) === 'object') {
             for(var a=0,l=RestrictionEdit.length;a<l;a++){
+
             for (var a = 0, l = RestrictionEdit.length; a < l; a++) {
                 if(Groups.indexOf(RestrictionEdit[a])!=-1) hotcat_CanEdit = true;
+
                 if (Groups.indexOf(RestrictionEdit[a]) != -1) hotcat_CanEdit = true;
 
             }
 
             }
 
         }
 
         }
 
     }
 
     }
     if(!hotcat_CanEdit) return;
+
     if (!hotcat_CanEdit) return;
 
     // Définition styles CSS
 
     // Définition styles CSS
 
     mw.loader.addStyleTag("" +
 
     mw.loader.addStyleTag("" +
Ligne 2 014 : Ligne 2 039 :
 
     );
 
     );
 
     var HCMmodules = [
 
     var HCMmodules = [
      mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=MediaWiki:Gadget-HotCatsMultiCustomEdit.js&action=raw&ctype=text/javascript'
+
        mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=MediaWiki:Gadget-HotCatsMultiCustomEdit.js&action=raw&ctype=text/javascript'
 
     ];
 
     ];
 
     var Lang = mw.config.get('wgUserLanguage');
 
     var Lang = mw.config.get('wgUserLanguage');
     if(!Lang) Lang = mw.config.get('wgContentLanguage');
+
     if (!Lang) Lang = mw.config.get('wgContentLanguage');
     if(Lang && Lang !== "fr"){
+
     if (Lang && Lang !== "fr") {
         HCMmodules.push('//fr.wikipedia.org/w/index.php?title=Mediawiki:Gadget-HotCatsMulti.js/i18n/'+Lang+'.js&action=raw&ctype=text/javascript');
+
         HCMmodules.push('//fr.wikipedia.org/w/index.php?title=Mediawiki:Gadget-HotCatsMulti.js/i18n/' + Lang + '.js&action=raw&ctype=text/javascript');
 
     }
 
     }
 
     // Lancement
 
     // Lancement
     mw.loader.implement( "HotCatsModules", HCMmodules, {}, {}, {} );
+
     mw.loader.implement("HotCatsModules", HCMmodules, {}, {}, {});
     mw.loader.using(["HotCatsModules", "jquery.ui.position"], function(){ $(hotcat_getDefaultsortAliasesAndMessages); });
+
     mw.loader.using(["HotCatsModules", "jquery.ui.position"], function() {
 +
        $(hotcat_getDefaultsortAliasesAndMessages);
 +
    });
 
};
 
};
  
  
if( mw.config.get('wgNamespaceNumber') > -1 && mw.config.get('wgNamespaceNumber')%2 === 0 && document.URL.indexOf("printable=yes") == -1 && ["history","delete"].indexOf(mw.config.get('wgAction')) === -1){
+
if (mw.config.get('wgNamespaceNumber') > -1 && mw.config.get('wgNamespaceNumber') % 2 === 0 && document.URL.indexOf("printable=yes") == -1 && ["history", "delete"].indexOf(mw.config.get('wgAction')) === -1) {
 
     hotcat_Launch();
 
     hotcat_Launch();
 
}
 
}
 +
       
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
//////////////////////////////////////////////////////////////////////////////////////////////////
 +
function CshowToggles() {
 +
    $content.find('span.CategoryTreeToggle').css('display', 'inline');
 +
}
 +
 +
function ChandleNode() {
 +
    var $link = $(this);
 +
    if ($link.data('ct-state') === 'Ccollapsed') {
 +
        CexpandNode($link);
 +
    } else {
 +
        CcollapseNode($link);
 +
    }
 +
}
 +
 +
function CexpandNode($link) {
 +
    var $children = $link.parents('.CategoryTreeItem').siblings('.CategoryTreeChildren');
 +
    $children.show();
 +
    $link.text(mw.msg('categorytree-collapse-bullet')).attr('title', mw.msg('categorytree-collapse')).data('ct-state', 'Cexpanded');
 +
    if (!$link.data('ct-loaded')) {
 +
        loadChildren($link, $children);
 +
    }
 +
}
 +
 +
function CcollapseNode($link) {
 +
    $link.parents('.CategoryTreeItem').siblings('.CategoryTreeChildren').hide();
 +
    $link.text(mw.msg('categorytree-expand-bullet')).attr('title', mw.msg('categorytree-expand')).data('ct-state', 'Ccollapsed');
 +
}
 +
 +
function CloadChildren($link, $children) {
 +
    var $linkParentCTTag, ctTitle, ctMode, ctOptions;
 +
 +
    function Cerror() {
 +
        var $retryLink;
 +
        $retryLink = $('<a>').text(mw.msg('categorytree-retry')).attr('href', '#').click(function(e) {
 +
            e.preventDefault();
 +
            loadChildren($link, $children);
 +
        });
 +
        $children.text(mw.msg('categorytree-error') + ' ').append($retryLink);
 +
    }
 +
    $link.data('Cct-loaded', true);
 +
    $children.append($('<i class="CategoryTreeNotice"></i>').text(mw.msg('categorytree-loading')));
 +
    $linkParentCTTag = $link.parents('.CategoryTreeTag');
 +
    ctTitle = $link.data('ct-title');
 +
    ctMode = $linkParentCTTag.data('ct-mode');
 +
    ctMode = typeof ctMode === 'number' ? ctMode : undefined;
 +
    ctOptions = $linkParentCTTag.data('ct-options') || mw.config.get('wgCategoryTreePageCategoryOptions');
 +
    if (typeof ctTitle !== 'string') {
 +
        error();
 +
        return;
 +
    }
 +
    $.get(mw.util.wikiScript(), {
 +
        skin: mw.config.get('skin'),
 +
        uselang: mw.config.get('wgUserLanguage'),
 +
        debug: mw.config.get('debug'),
 +
        action: 'ajax',
 +
        rs: 'efCategoryTreeAjaxWrapper',
 +
        rsargs: [ctTitle, ctOptions, 'json']
 +
    }).done(function(data) {
 +
        data = data.replace(/^\s+|\s+$/, '');
 +
        data = data.replace(/##LOAD##/g, mw.msg('categorytree-expand'));
 +
        if (data === '') {
 +
            switch (ctMode) {
 +
                case 0:
 +
                    data = mw.msg('categorytree-no-subcategories');
 +
                    break;
 +
                case 10:
 +
                    data = mw.msg('categorytree-no-pages');
 +
                    break;
 +
                case 100:
 +
                    data = mw.msg('categorytree-no-parent-categories');
 +
                    break;
 +
                default:
 +
                    data = mw.msg('categorytree-nothing-found');
 +
            }
 +
            data = $('<i class="CategoryTreeNotice"></i>').text(data);
 +
        }
 +
        $children.html(data).find('.CategoryTreeToggle').click(ChandleNode);
 +
        CshowToggles();
 +
    }).fail(error);
 +
}
 +
 +
//$('.sitenoticetree').first().delay(5000).load('https://wiki.nuitdebout.fr/index.php?title=Sp%C3%A9cial%3AArbreCat%C3%A9gorie&target=NuitDebout&mode=categories&namespaces= .CategoryTreeResult');
 +
 +
//$("#SiteNotice").find('.CategoryTreeToggle').css('display', 'inline');//.click(handleNode());
 +
 +
//$("#SiteNotice").find('.CategoryTreeToggle').css('color', 'red');//.click(handleNode());
 +
 +
 +
 +
 +
/////////////////////////////////
 +
var customizeToolbar = function() {
 +
 +
 +
 +
/*start toolbar section*/
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'sections': {
 +
'emoticons': {
 +
'type': 'toolbar', // Can also be 'booklet'
 +
'label': 'Emoticons'
 +
// or 'labelMsg': 'section-emoticons-label' for a localized label
 +
}
 +
}
 +
} );
 +
 +
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'sections': {
 +
'categs': {
 +
'type': 'toolbar', // Can also be 'booklet'
 +
'label': 'Catégories'
 +
// or 'labelMsg': 'section-emoticons-label' for a localized label
 +
}
 +
}
 +
} );
 +
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'sections': {
 +
'templates': {
 +
'type': 'toolbar', // Can also be 'booklet'
 +
'label': 'Raccourcis'
 +
// or 'labelMsg': 'section-emoticons-label' for a localized label
 +
}
 +
}
 +
} );
 +
 +
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'sections': {
 +
'videos': {
 +
'type': 'toolbar', // Can also be 'booklet'
 +
'label': 'video'
 +
// or 'labelMsg': 'section-emoticons-label' for a localized label
 +
}
 +
}
 +
} );
 +
 +
/*end toolbar section*/
 +
 +
/*start group section*/
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'emoticons',
 +
'groups': {
 +
'faces': {
 +
'label': 'Faces' // or use labelMsg for a localized label, see above
 +
}
 +
}
 +
} );
 +
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'templates',
 +
'groups': {
 +
'shorts': {
 +
'label': 'raccourci' // or use labelMsg for a localized label, see above
 +
}
 +
}
 +
} );
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'categs',
 +
'groups': {
 +
'city': {
 +
'label': 'Villes Debouts' // or use labelMsg for a localized label, see above
 +
}
 +
}
 +
} );
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'categs',
 +
'groups': {
 +
'wiki': {
 +
'label': 'Wiki' // or use labelMsg for a localized label, see above
 +
}
 +
}
 +
} );
 +
 +
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'videos',
 +
'groups': {
 +
'video': {
 +
'label': 'video' // or use labelMsg for a localized label, see above
 +
}
 +
}
 +
} );
 +
 +
 +
 +
/*end groups section*/
 +
 +
/*start button group section*/
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'emoticons',
 +
'group': 'faces',
 +
'tools': {
 +
'smile': {
 +
label: 'Smile!', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: ":)" // text to be inserted
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'categs',
 +
'group': 'city',
 +
'tools': {
 +
'smile': {
 +
label: 'Smile!', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: "[[Category:Commission]]" // text to be inserted
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'categs',
 +
'group': 'city',
 +
'tools': {
 +
'smile': {
 +
label: 'Smile!', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: "[[Category:Compte_rendu_d'AG]]" // text to be inserted
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
 +
 +
 +
 +
 +
 +
 +
//UploadWizard
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'templates',
 +
'group': 'shorts',
 +
'tools': {
 +
'code': {
 +
label: 'Liste de sous-pages', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
pre: "{{Special:Index/{{FULLPAGENAME}}/}}" // text to be inserted
 +
}
 +
}
 +
 +
}
 +
}
 +
} );
 +
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'templates',
 +
'group': 'shorts',
 +
'tools': {
 +
'shortlinks': {
 +
label: 'liste de composants!', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
 +
action: {
 +
type: 'encapsulate',
 +
options: {
 +
                'pre':
 +
                "{| class='wikitable' border='1' "+
 +
                "|-! Composant "+
 +
                "! Valeur/TYPE"+ 
 +
"! quantité "+
 +
"|-"+
 +
"| Résistance:"+
 +
"| 1K Ohm"+
 +
"| 5"+
 +
"|-"+
 +
"| Résistance:"+
 +
"| 100 Ohm"+
 +
"| 5"+
 +
"|-"+
 +
"| Résistance:"+
 +
"| 10K Ohm"+
 +
"| 1"+
 +
"|-"+
 +
"| Potentiomètre:"+
 +
"| 10K Ohm Linéaire"+
 +
"| 1"+
 +
"|-"+
 +
"| Transistor:"+
 +
"| 2N2222"+
 +
"| 4"+
 +
"|-"+
 +
"| Condensateur:"+
 +
"| 100 µF"+
 +
"| 1"+
 +
"|-"+
 +
"| Condensateur:"+
 +
"| 0.01 µF"+
 +
"| 5"+
 +
"|-"+
 +
"| Arduino:"+
 +
"| Uno ou + (à adapter)"+
 +
"| 1"+
 +
"|}",
 +
             
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
 +
 +
 +
 +
//video buttons
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'videos',
 +
'group': 'video',
 +
'tools': {
 +
'archive': {
 +
label: 'Archive.org!', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//wiki.nuitdebout.fr/images/d/d0/Logovideo.png',
 +
action: {
 +
type: 'replace',
 +
options: {
 +
                'pre': "{{#Widget:Archive.org|id=",
 +
                'periMsg': 'idvideo',
 +
                'post': "}}"
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'videos',
 +
'group': 'video',
 +
'tools': {
 +
'vimeo': {
 +
label: 'Vimeo', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//wiki.nuitdebout.fr/images/d/d0/Logovideo.png',
 +
action: {
 +
type: 'replace',
 +
options: {
 +
 +
                'pre': "{{#Widget:Vimeo|id=",
 +
                'periMsg': 'idvideo',
 +
                'post': "}}"
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'videos',
 +
'group': 'video',
 +
'tools': {
 +
'youtube': {
 +
label: 'Youtube', // or use labelMsg for a localized label, see above
 +
type: 'button',
 +
icon: '//wiki.nuitdebout.fr/images/d/d0/Logovideo.png',
 +
action: {
 +
type: 'replace',
 +
options: {
 +
 +
                'pre': "{{#Widget:Youtube|id=",
 +
                'periMsg': 'idvideo',
 +
                'post': "}}"
 +
}
 +
}
 +
}
 +
}
 +
} );
 +
 +
 +
};
 +
 +
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
 +
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
 +
mw.loader.using( 'user.options', function () {
 +
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
 +
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
 +
$.when(
 +
mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
 +
).then( customizeToolbar );
 +
}
 +
} );
 +
}
 +
// Add the customizations to LiquidThreads' edit toolbar, if available
 +
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
  
 +
$("div.portal h3").click(function() {
  
 +
  $("this").next().toggle(500);
 +
});
  
//</nowiki></pre></source>
+
        //</nowiki></pre></source>

Version actuelle en date du 17 juillet 2016 à 06:02

/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
// Affiche un lien "Sous-pages" dans les outils.
var subPagesLink = function($) {
    var NSWithoutSubpages = new Array(-1, 6, 14, 104, 105);
    if (NSWithoutSubpages.indexOf(mw.config.get('wgNamespaceNumber')) == -1) {
        mw.util.addPortletLink('p-tb', mw.config.get('wgServer') + '/wiki/Spécial:Index/' + mw.config.get('wgPageName') + '/', 'Sous-pages');
    }
}
$(document).ready(subPagesLink);


/**
 * Boîtes déroulantes
 *
 * Pour [[Modèle:Méta palette de navigation]]
 */

var Palette_Enrouler = '[masquer]';
var Palette_Derouler = '[afficher]';

var Palette_max = 1;

function Palette_toggle($table) {
    $table.find('tr:not(:first)').toggleClass('navboxHidden');
}

function Palette(element) {
    if (!element) {
        element = document;
    }
    var $tables = $(element).find('table.collapsible');
    var autoCollapse = $tables.length > Palette_max;

    $.each($tables, function(_, table) {
        var $table = $(table);
        var collapsed = $table.hasClass('collapsed') || (autoCollapse && $table.hasClass('autocollapse'));
        $table.find('tr:first th:first').prepend(
            $('<span class="navboxToggle">\u00a0</span>').append(
                $('<a href="#">' + (collapsed ? Palette_Derouler : Palette_Enrouler) + '</a>').click(function() {
                    if ($(this).text() === Palette_Enrouler) {
                        $(this).text(Palette_Derouler);
                    } else {
                        $(this).text(Palette_Enrouler);
                    }
                    Palette_toggle($table);
                    return false;
                })
            )
        );
        if (collapsed) {
            Palette_toggle($table);
        }
    });
}
$(function() {
    Palette();
});


/**
 * Pour [[Modèle:Boîte déroulante]]
 */

var BoiteDeroulante_Enrouler = '[masquer]';
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 = [];
    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 ($(Contents[a]).hasClass('NavContent')) {
                Contents[a].style.display = 'none';
                return;
            }
        }
    } else {
        NavToggle.innerHTML = caption[1];
        for (var a = 0, m = Contents.length; a < m; a++) {
            if ($(Contents[a]).hasClass("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 ($(NavFrames[i]).hasClass('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);
            }
        }
    }

}

mw.hook('wikipage.content').add(function() {
    BoiteDeroulante();
});


// ******************************* HOTCATSMULTI ******************************* //

/**
 * Ajoute des liens après les catégories pour rapidement
 * supprimer / modifier / ajouter une catégorie sur un article.
 * Utilise Ajax et l'api MediaWiki pour rechercher une catégorie.
 * Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]]
 *
 * Auteur original : Magnus Manske
 * Adaptation pour WP:fr : Zelda
 * Adaptation édition multiple : Dr Brains
 *
 * {{Catégorisation JS|HotCatsMulti}}
 */

//<source lang=javascript><pre><nowiki>
///////////////////////// VARIABLES ////////////////////////////////////////////////////////

//// PARAMÈTRES PERSONNALISABLES ////

// Délai avant les suggestions, en ms
window.hotcat_suggestion_delay = 200;

// Taille de la liste déroulante (en items)
window.hotcat_list_size = 10;

// Nombre de catégories suggérées lors de la recherche (maximum autorisé : 4999 pour les sysop et les bots, 499 pour les autres utilisateurs)
window.hotcat_list_items = 50;

// Permet d'afficher la liste de suggestion vers le bas
window.hotcat_list_down = false;

// Permet d'enregistrer automatiquement la modification
window.hotcat_autocommit = true;

// Modification mineure ( -1 = défaut ; 0 = jamais ; 1 = toujours )
window.hotcat_Minoredit = 1;

// Suivre la page modifiée ( -1 = défaut ; 0 = jamais ; 1 = toujours )
window.hotcat_Watchthis = -1;

// Activation automatique du mode "multi"
window.hotcat_AutoMulti = false;

// Afficher de la légende
window.hotcat_ShowLegend = true;

// Afficher sur une seule ligne
window.hotcat_ShowInline = false;

// Ne pas confirmer la suppression
window.hotcat_SkipConfirm = false;

// Ne pas afficher le récapitulatif
window.hotcat_SkipRecap = false;

// Afficher le bouton pour suggérer les catégories-mères
window.hotcat_ParentButton = true;

// Afficher le bouton pour suggérer les catégories-filles
window.hotcat_DaughterButton = true;

// Icônes pour signifier l'existence ou non de la catégorie choisie
window.hotcat_exists_size = 20;
window.hotcat_exists_yes = "//upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png";
window.hotcat_exists_no = "//upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png";

// Lien vers la documentation
window.hotcat_docURL = "//fr.wikipedia.org/wiki/Projet:JavaScript/Notices/HotCatsMulti#Fonctionnement";

// ID du lien pour les catégories cachées
window.hotcat_HiddenCatsLinkID = "mw-hidden-cats-link";

// Titre de catégorie sensible à la casse de la première lettre
window.hotcat_CaseSensitive = false;

// Mode débuggage
window.hotcat_DebugMode = false;

// Groupe nécessaire pour appliquer une balise
window.hotcat_TagGroup = "user";

// Affichage pour une langue se lisant de droite à gauche.
window.hotcat_rtl = $('body').hasClass('rtl');

//// TEXTES ////

window.hotcat_text_MultiLinkText = "(±)";
window.hotcat_text_MultiLinkTitle = "Modifier plusieurs catégories";
window.hotcat_text_MultiInputOK = "Valider";
window.hotcat_text_MultiInputCancel = "Annuler";

window.hotcat_text_Minoredit = "Édition mineure : $1";
window.hotcat_text_Watchthis = "Suivre cette page : $1";
window.hotcat_text_RadioDefault = "Défaut";
window.hotcat_text_RadioYes = "Oui";
window.hotcat_text_RadioNo = "Non";

window.hotcat_text_LabelText = "Légende :";
window.hotcat_text_LabelTitle = "Voir la page d\'aide (nouvelle fenêtre)";

window.hotcat_text_DefaultSortText = "(D)";
window.hotcat_text_DefaultSortTitle = "Ajouter/modifier/supprimer la clef de tri principale";

window.hotcat_text_RemoveLinkText = "(–)";
window.hotcat_text_RemoveLinkTitle = "Supprimer la catégorie « $1 »";
window.hotcat_text_RemoveConfirm = "Voulez-vous vraiment supprimer la catégorie « $1 » ?";
window.hotcat_text_ModifyLinkText = "(±)";
window.hotcat_text_ModifyLinkTitle = "Modifier la catégorie « $1 »";
window.hotcat_text_AddLinkText = "(+)";
window.hotcat_text_AddLinkTitle = "Ajouter une catégorie";

window.hotcat_text_Exists_YesTitle = "Cette catégorie existe.";
window.hotcat_text_Exists_NoTitle = "Cette catégorie n'existe pas.";
window.hotcat_text_ParentTitle = "Suggérer les catégories-mères";
window.hotcat_text_ParentText = "↑";
window.hotcat_text_DaughterTitle = "Suggérer les catégories-filles";
window.hotcat_text_DaughterText = "↓";
window.hotcat_text_InputOK = "OK";
window.hotcat_text_InputCancel = "Annuler";

window.hotcat_text_RecapTitle = 'Récapitulatif :';
window.hotcat_text_RecapRemove = 'Catégories à supprimer';
window.hotcat_text_RecapModify = 'Catégories à modifier';
window.hotcat_text_RecapAdd = 'Catégories à ajouter';
window.hotcat_text_RecapSort = 'Clef de tri globale';

window.hotcat_text_AlertProblem1 = "Impossible de trouver la catégorie « $1 » - elle est peut-être incluse via un modèle.";
window.hotcat_text_AlertProblem2 = "La catégorie « $1 » est déjà présente.";
window.hotcat_text_AlertProblem3 = "Plusieurs occurrences de la catégorie « $1 » trouvées.";


window.hotcat_text_ResumeScript = "[[Projet:JavaScript/Notices/HotCatsMulti|HotCatsMulti]] : ";

window.hotcat_text_NoCatTemplate = "à catégoriser";

window.hotcat_text_HotCatTag = "";
if (mw.config.get('wgServer') == '//fr.wikipedia.org') window.hotcat_text_HotCatTag = "HotCats";


//// VARIABLES NON PERSONNALISABLES ////

window.hotcat_text_SystemMessage = {
    "red-link-title": false,
    "pagecategorieslink": false,
    "categories": false,
    "pagecategories": false
};


window.hotcat_Multi_Edit = false;
window.hotcat_suggest_running = 0;
window.hotcat_running = 0;
window.hotcat_last_v = "";
window.hotcat_last_key = "";
window.hotcat_OldDefaultSort = "";
window.hotcat_OldPageContent = false;
window.hotcat_Form_Index = 1000;
window.hotcat_NewCatsIndex = 2000;
window.hotcat_CatNamespace = mw.config.get('wgFormattedNamespaces')[14] + ':';
window.hotcat_DefaultsortAliases = [];
window.hotcat_Multi_IsEditPage = ((mw.config.get('wgAction') == "edit") || (mw.config.get('wgAction') == "submit"));
window.hotcat_Multi_IsSection = false;

window.hotcat_SpanMatrix = [];
window.hotcat_CatLinkMatrix = [];
window.hotcat_CatLinkIsRedMatrix = [];
window.hotcat_RemoveLinkMatrix = [];
window.hotcat_ModifyLinkMatrix = [];
window.hotcat_FormMatrix = [];
window.hotcat_TextMatrix = [];
window.hotcat_ListMatrix = [];
window.hotcat_ExistMatrix = [];
window.hotcat_CatNameMatrix = [];
window.hotcat_SortMatrix = [];

///////////////////////// AJAX ////////////////////////////////////////////////////////

window.hotcat_ajax = {
    http: function(bundle) {
        var xmlhttp;
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    xmlhttp = false;
                }
            }
        }
        if (xmlhttp) {
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4)
                    hotcat_ajax.httpComplete(xmlhttp, bundle);
            };
            xmlhttp.open(bundle.method ? bundle.method : "GET", bundle.url, bundle.async === false ? false : true);
            if (bundle.headers) {
                for (var field in bundle.headers)
                    try {
                        xmlhttp.setRequestHeader(field, bundle.headers[field]);
                    } catch (err) {}
            }
            xmlhttp.send(bundle.data ? bundle.data : null);
        }
        return xmlhttp;
    },
    httpComplete: function(xmlhttp, bundle) {
        if (xmlhttp.status == 200 || xmlhttp.status == 302) {
            if (bundle.onSuccess) bundle.onSuccess(xmlhttp, bundle);
        } else if (bundle.onFailure) {
            bundle.onFailure(xmlhttp, bundle);
        }
    }
};


///////////////////////// REQUÊTES PRÉLIMINAIRES ////////////////////////////////////////////////////////


// RÉCUPÉRATION ALIAS DE LA CLEF DE TRI GLOBALE ET DES MESSAGES SYSTEME

// Mise à jour du cookie

window.hotcat_SetCookie = function(cookieName, cookieValue) {
    var now = new Date();
    var nextYear = new Date(now.getTime() + 1000 * 60 * 60 * 24 * 365);
    return jQuery.cookie(cookieName, cookieValue, {
        expires: nextYear,
        path: "/"
    });
};

// Interrogation du cookie

window.hotcat_GetCookie = function(cookieName) {
    return jQuery.cookie(cookieName);
};

window.hotcat_getDefaultsortAliasesAndMessages = function(Mode) {
    var meta = [];
    var otherparams = {};
    var missingmessages = [];
    var CookieMessages = hotcat_GetCookie("hotcatmessages");
    if (CookieMessages) {
        CookieMessages = CookieMessages.split("||");
        for (var Message in hotcat_text_SystemMessage) {
            var found = false;
            for (var a = 0, l = CookieMessages.length; a < l; a++) {
                if (CookieMessages[a].indexOf(Message + "::") !== 0) continue;
                found = true;
                hotcat_text_SystemMessage[Message] = CookieMessages[a].split("::")[1];
            }
            if (!found) missingmessages.push(Message);
        }

    } else {
        for (var Message in hotcat_text_SystemMessage) {
            missingmessages.push(Message);
        }
    }
    if (missingmessages.length > 0) {
        meta.push("allmessages");
        otherparams["ammessages"] = missingmessages.join("|");
    }
    var CookieDefaultsortAliases = hotcat_GetCookie("hotcatdefaultsortaliases");
    if (CookieDefaultsortAliases) {
        hotcat_DefaultsortAliases = CookieDefaultsortAliases.split("||");
    }
    if (hotcat_DefaultsortAliases.length === 0) {
        meta.push("siteinfo");
        otherparams["siprop"] = "magicwords";
    }
    if (meta.length === 0) {
        hotcat_getOldPageContent();
        return;
    }
    var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&meta=' + meta.join("|");
    for (var paramname in otherparams) {
        URL += "&" + paramname + "=" + otherparams[paramname];
    }
    hotcat_ajax.http({
        url: URL,
        onSuccess: hotcat_receiveDefaultsortAliasesAndMessages,
        nextcallback: hotcat_getOldPageContent
    });
};

window.hotcat_receiveDefaultsortAliasesAndMessages = function(Req, data) {
    var Response = Req.responseXML;
    var MagicWords = Response.getElementsByTagName('magicword');
    if (MagicWords.length > 0) {
        for (var a = 0; a < MagicWords.length; a++) {
            var MagicWordName = MagicWords[a].getAttribute('name');
            if (MagicWordName == "defaultsort") {
                var Aliases = MagicWords[a].getElementsByTagName('alias');
                for (var b = 0; b < Aliases.length; b++) {
                    var ThisAlias = Aliases[b].firstChild.nodeValue;
                    ThisAlias = ThisAlias.replace(/:/g, "");
                    if (hotcat_DefaultsortAliases.indexOf(ThisAlias) == -1) hotcat_DefaultsortAliases.push(ThisAlias);
                }
            }
        }
        hotcat_SetCookie("hotcatdefaultsortaliases", hotcat_DefaultsortAliases.join("||"));
    }
    var Messages = Response.getElementsByTagName('message');
    if (Messages.length > 0) {
        var cookievalue = [];
        for (var a = 0; a < Messages.length; a++) {
            var MessageName = Messages[a].getAttribute('name');
            var MessageContent = (Messages[a].firstChild ? Messages[a].firstChild.nodeValue : "");
            for (var Message in hotcat_text_SystemMessage) {
                if (MessageName == Message) {
                    hotcat_text_SystemMessage[Message] = MessageContent;
                    cookievalue.push(Message + "::" + MessageContent);
                }
            }
        }
        hotcat_SetCookie("hotcatmessages", cookievalue.join("||"));
    }
    if (typeof(data.nextcallback) === "function") data.nextcallback(data);
};

// RÉCUPÉRATION DU CONTENU ACTUEL DE LA PAGE (asynchrone ou synchrone)

window.hotcat_getOldPageContent = function() {
    var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=raw&oldid=' + mw.config.get('wgCurRevisionId');
    hotcat_ajax.http({
        url: URL,
        onSuccess: hotcat_receiveOldPageContent
    });
};

window.hotcat_receiveOldPageContent = function(Req, data) {
    hotcat_OldPageContent = Req.responseText;
    hotcat();
};

window.hotcat_gettag = function() {
    if (!hotcat_text_HotCatTag || !hotcat_TagGroup) return false;
    var UserGroups = mw.config.get('wgUserGroups');
    if (UserGroups === null) UserGroups = ["*"];
    if (UserGroups.indexOf(hotcat_TagGroup) !== -1) return hotcat_text_HotCatTag;
    return false;
};


// FONCTION DE TRANSFORMATION INITIALE

window.hotcat = function() {
    if (hotcat_running !== 0) return;
    hotcat_running = 1;
    var catlinks = document.getElementById("catlinks");
    var hotcatStop = hotcat_getSectionNumber();
    if (hotcatStop) {
        if (catlinks) catlinks.parentNode.removeChild(catlinks);
        return;
    }
    if (!catlinks) {
        var bodyC = document.getElementById("bodyContent"); // Monobook, Chick, Simple, Mymw.config.get('skin'), Vector
        if (!bodyC) bodyC = document.getElementById("article"); // Cologneblue, Nostalgia, Standard
        if (!bodyC) bodyC = document.getElementById("mw_contentholder"); // Modern
        if (!bodyC) return;
        catlinks = document.createElement("div");
        catlinks.id = "catlinks";
        catlinks.className = "catlinks";
        catlinks = bodyC.appendChild(catlinks);
    } else {
        $(catlinks).removeClass("catlinks-allhidden");
    }
    if (typeof(hotcat_LangCustom) == "function") hotcat_LangCustom();
    if (typeof(hotcat_SiteCustom) == "function") hotcat_SiteCustom();
    if (typeof(hotcat_UserCustom) == "function") hotcat_UserCustom();
    if (mw.config.get('wgAction') == "edit") hotcat_list_down = true;
    var catline = document.getElementById('mw-normal-catlinks');
    if (!catline || catline === null || typeof catline == 'undefined') {
        catline = catlinks.insertBefore(document.createElement("div"), catlinks.firstChild);
        catline.id = "mw-normal-catlinks";
    }
    hotcat_append_firstlink(catline);
    hotcat_modify_existing(catline);
    hotcat_append_add_span(catline);
    hotcat_append_multiedit_span(catline);
    if (hotcat_Multi_IsEditPage) {
        var CatLine = document.getElementById("catlinks");
        var PreviewWindow = document.getElementById("wikiPreview");
        if ((CatLine) && (PreviewWindow)) {
            CatLine.parentNode.removeChild(CatLine);
            PreviewWindow.parentNode.insertBefore(CatLine, PreviewWindow.nextSibling);
            hotcat_update_existing();
        }
    }
};

// DÉTERMINATION DE LA SECTION ÉDITÉE  (si section et section != dernière ou section == new : arrêt hotCats)

window.hotcat_getSectionNumber = function() {
    if (!hotcat_Multi_IsEditPage) return false;
    var SectionNumber = document.editform.wpSection.value;
    if (SectionNumber === "") return false;
    hotcat_Multi_IsSection = SectionNumber;
    if (SectionNumber === "new") return true;
    SectionNumber = parseInt(SectionNumber);
    hotcat_Multi_IsSection = SectionNumber;
    var SectionRegExp = new RegExp("[^=\\|\\{\n]*={1,6}[^=\n]+={1,6}\n", "ig");
    var Sections = hotcat_OldPageContent.match(SectionRegExp);
    if (Sections === null) return false;
    if (Sections.length === SectionNumber) return false;
    return true;
};

// CRÉATION DU LIEN "CATÉGORIES"

window.hotcat_append_firstlink = function(catline, plural) {
    if (!hotcat_text_SystemMessage.pagecategorieslink || !hotcat_text_SystemMessage.categories || !hotcat_text_SystemMessage.pagecategories) {
        hotcat_GetMessages(false);
    }
    if (!catline.firstChild) {
        var a = document.createElement('a');
        a.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_text_SystemMessage.pagecategorieslink);
        a.title = hotcat_text_SystemMessage.categories;
        a.appendChild(document.createTextNode(hotcat_PLURAL(hotcat_text_SystemMessage.pagecategories, plural)));
        catline.appendChild(a);
        catline.appendChild(document.createTextNode(' : '));
    } else {
        catline.firstChild.title = hotcat_text_SystemMessage.categories;
    }
};

// MODIFICATION DE LA BARRE DE CATÉGORIES

window.hotcat_modify_existing = function(catline) {
    var ul = catline.getElementsByTagName("ul")[0];
    if (!ul) { // ( Mediawiki < 1.18 )
        var spans = catline.getElementsByTagName("span");
        for (var i = 0, l = spans.length; i < l; i++) {
            hotcat_modify_span(spans[i], i);
        }
        return;
    }
    var lis = ul.getElementsByTagName("li");
    for (var i = 0, l = lis.length; i < l; i++) {
        var li = lis[i];
        var cat_link = li.getElementsByTagName('a')[0];
        var span = document.createElement('span');
        li.appendChild(span);
        span.appendChild(cat_link);
        hotcat_modify_span(span, i);
    }
};

// AJOUT DES LIENS (–) ET (±)

window.hotcat_modify_span = function(span, i) {
    if (!hotcat_text_SystemMessage["red-link-title"]) hotcat_GetMessages(false);
    var cat_link = span.getElementsByTagName('a')[0];
    if (!cat_link) return;
    cat_link.id = "CatLink_" + i;
    var cat_title = cat_link.title;
    if (!cat_title) return;
    cat_title = cat_title.split(hotcat_CatNamespace).join('');
    cat_title = cat_title.replace(hotcat_text_SystemMessage["red-link-title"].split('$1').join(''), "");
    var sep1 = document.createTextNode(" ");
    span.id = "hotcat_Span_" + i;
    var a1 = document.createTextNode("(–)");
    var remove_link = document.createElement("a");
    var remove_id = "hotcat_remove_" + i;
    remove_link.id = remove_id;
    remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\"," + i + ");";
    remove_link.title = hotcat_text_RemoveLinkTitle.split("$1").join(cat_title);
    remove_link.appendChild(a1);
    span.appendChild(sep1);
    span.appendChild(remove_link);
    var mod_id = "hotcat_modify_" + i;
    var sep2 = document.createTextNode(" ");
    var a2 = document.createTextNode("(±)");
    var modify_link = document.createElement("a");
    modify_link.id = mod_id;
    modify_link.href = "javascript:hotcat_modify(\"" + cat_title + "\"," + i + ");";
    modify_link.title = hotcat_text_ModifyLinkTitle.split("$1").join(cat_title);
    modify_link.appendChild(a2);
    span.appendChild(sep2);
    span.appendChild(modify_link);
    hotcat_SpanMatrix[i] = span;
    hotcat_CatLinkMatrix[i] = cat_link;
    hotcat_CatLinkIsRedMatrix[i] = !!($(cat_link).hasClass("new"));
    hotcat_CatNameMatrix[i] = cat_title;
    hotcat_RemoveLinkMatrix[i] = remove_link;
    hotcat_ModifyLinkMatrix[i] = modify_link;
};

// AJOUT DU LIEN (+)

window.hotcat_append_add_span = function(catline) {
    var Spans = catline.getElementsByTagName('span');
    var span_add = document.createElement('span');
    var a_add = document.createElement("a");
    var a_text = document.createTextNode(hotcat_text_AddLinkText);
    span_add.id = "hotcat_add";
    a_add.id = "hotcat_addlink";
    a_add.href = "javascript:hotcat_add_new(" + hotcat_Form_Index + ")";
    a_add.title = hotcat_text_AddLinkTitle;
    a_add.appendChild(a_text);
    span_add.appendChild(a_add);
    if (Spans[0]) catline.appendChild(document.createTextNode(' | '));
    catline.appendChild(span_add);
    hotcat_SpanMatrix[hotcat_Form_Index] = span_add;
    hotcat_Form_Index++;
};

///////////////////////// ÉDITION SIMPLE ////////////////////////////////////////////////////////

// FONCTION DE RETRAIT D'UNE CATÉGORIE

window.hotcat_remove = function(cat_title, Index) {
    if (!hotcat_Multi_Edit) {
        var RemovedCategories = [];
        var ModifiedCategories_from = [];
        var ModifiedCategories_to = [];
        var AddedCategories = [];
        RemovedCategories.push(cat_title);
        if (hotcat_SkipConfirm || confirm(hotcat_text_RemoveConfirm.split("$1").join(cat_title))) {
            hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, hotcat_OldDefaultSort);
        }
    } else {
        var Span = hotcat_SpanMatrix[Index];
        if ($(Span).hasClass("AddedCatSpan")) {
            Span.parentNode.removeChild(Span);
        } else {
            var FirstLink = hotcat_CatLinkMatrix[Index];
            var OldCat = hotcat_CatNameMatrix[Index];
            FirstLink.innerHTML = OldCat;
            FirstLink.title = hotcat_CatNamespace + OldCat;
            FirstLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + OldCat);
            $(FirstLink).addClass('RemovedCategory');
            $(FirstLink).removeClass("ModifiedCategory");
            if (hotcat_CatLinkIsRedMatrix[Index]) {
                if (!$(FirstLink).hasClass("new")) $(FirstLink).addClass("new");
            } else {
                $(FirstLink).removeClass("new");
            }
        }
        hotcat_Multi_CheckForChanges();
    }
};

// MODIFICATION D'UNE CATÉGORIE

window.hotcat_modify = function(catname, Index) {
    var link = hotcat_CatLinkMatrix[Index];
    var span = hotcat_SpanMatrix[Index];
    var Links = span.getElementsByTagName('a');
    for (a = 0; a < Links.length; a++) {
        Links[a].style.display = "none";
    }
    span.firstChild.style.display = "none";
    hotcat_create_new_span(span, catname, Index);
    hotcat_text_changed(Index);
};

// AJOUT D'UNE CATÉGORIE

window.hotcat_add_new = function(Index) {
    var span_add = document.getElementById("hotcat_add");
    span_add.getElementsByTagName('a')[0].style.display = "none";
    hotcat_create_new_span(span_add, "", Index);
};

// CRÉATION DU FORMULAIRE DE MODIFICATION OU D'AJOUT D'UNE CATÉGORIE

window.hotcat_create_new_span = function(thespan, init_text, Index) {
    var DefaultSort = hotcat_defaultSort_getOneOld(init_text);
    if ($(thespan).hasClass("AddedCatSpan")) DefaultSort = hotcat_SortMatrix[Index];
    hotcat_CatNameMatrix[Index] = init_text;
    var form = document.createElement("form");
    form.id = "hotcat_form" + Index;
    form.method = "post";
    form.onsubmit = function() {
        var FormIndex = hotcat_getIndex(this);
        hotcat_ok(FormIndex);
        return false;
    };
    form.style.display = "inline";
    var text = document.createElement("input");
    text.size = 40;
    text.id = "hotcat_text" + Index;
    text.type = "text";
    text.value = init_text + DefaultSort;
    text.onkeyup = function() {
        var FormIndex = hotcat_getIndex(this);
        window.setTimeout("hotcat_text_changed(" + FormIndex + ");", hotcat_suggestion_delay);
    };
    var list = document.createElement("select");
    list.id = "hotcat_list" + Index;
    list.style.display = "none";
    list.onclick = function() {
        var FormIndex = hotcat_getIndex(this);
        hotcat_text_replace(FormIndex);
    };
    var exists = document.createElement("img");
    exists.id = "hotcat_exists" + Index;
    exists.height = hotcat_exists_size;
    exists.width = hotcat_exists_size;
    exists.title = hotcat_text_Exists_NoTitle;
    exists.src = hotcat_exists_no;
    var ParentCats = document.createElement("input");
    ParentCats.id = "hotcat_parents" + Index;
    ParentCats.type = "button";
    ParentCats.value = hotcat_text_ParentText;
    ParentCats.title = hotcat_text_ParentTitle;
    ParentCats.onclick = function() {
        var FormIndex = hotcat_getIndex(this);
        hotcat_text_changed(FormIndex, "UP");
    };
    var DaughterCats = document.createElement("input");
    DaughterCats.id = "hotcat_daughters" + Index;
    DaughterCats.type = "button";
    DaughterCats.value = hotcat_text_DaughterText;
    DaughterCats.title = hotcat_text_DaughterTitle;
    DaughterCats.onclick = function() {
        var FormIndex = hotcat_getIndex(this);
        hotcat_text_changed(FormIndex, "DOWN");
    };
    var OK = document.createElement("input");
    OK.id = "hotcat_OK" + Index;
    OK.type = "button";
    OK.value = hotcat_text_InputOK;
    OK.onclick = function() {
        var FormIndex = hotcat_getIndex(this);
        hotcat_ok(FormIndex);
    };
    var cancel = document.createElement("input");
    cancel.id = "hotcat_cancel" + Index;
    cancel.type = "button";
    cancel.value = hotcat_text_InputCancel;
    cancel.onclick = function() {
        var FormIndex = hotcat_getIndex(this);
        hotcat_cancel(FormIndex);
    };
    form.appendChild(text);
    form.appendChild(list);
    form.appendChild(exists);
    if (hotcat_ParentButton) {
        form.appendChild(ParentCats);
    }
    if (hotcat_DaughterButton) {
        form.appendChild(DaughterCats);
    }
    form.appendChild(OK);
    form.appendChild(cancel);
    thespan.appendChild(form);
    text.focus();
    hotcat_upDate_FormPositions();
    hotcat_FormMatrix[Index] = form;
    hotcat_TextMatrix[Index] = text;
    hotcat_ListMatrix[Index] = list;
    hotcat_ExistMatrix[Index] = exists;
};

// VALIDATION DU FORMULAIRE

window.hotcat_ok = function(Index) {
    var Form = hotcat_FormMatrix[Index];
    var Input = hotcat_TextMatrix[Index];
    var TheSpan = hotcat_SpanMatrix[Index];
    var CatLink = hotcat_CatLinkMatrix[Index];
    var IfExist = hotcat_ExistMatrix[Index];
    var OldCatName = hotcat_CatNameMatrix[Index];
    var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
    var NewCatName = Input.value.ucFirst().replace(/\|.*/, "");
    var NewDefaultSort = Input.value.ucFirst().split(NewCatName).join("");
    hotcat_SortMatrix[Index] = NewDefaultSort;
    if (NewCatName == "") {
        hotcat_cancel(Index);
        return;
    }
    if (hotcat_Multi_Edit == false) {
        if ((OldCatName + OldDefaultSort) == (NewCatName + NewDefaultSort)) return;
        var RemovedCategories = [];
        var ModifiedCategories_from = [];
        var ModifiedCategories_to = [];
        var AddedCategories = [];
        if (TheSpan.id != "hotcat_add") {
            ModifiedCategories_from.push(OldCatName + OldDefaultSort);
            ModifiedCategories_to.push(NewCatName + NewDefaultSort);
        } else {
            AddedCategories.push(NewCatName + NewDefaultSort);
        }
        hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, hotcat_OldDefaultSort);
    } else {
        var Exist = (IfExist.title == hotcat_text_Exists_YesTitle);
        if (TheSpan.id != "hotcat_add") {
            CatLink.innerHTML = NewCatName;
            CatLink.title = hotcat_CatNamespace + NewCatName;
            CatLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + NewCatName);
            if ((!$(CatLink).hasClass("AddedCategory")) && (!$(CatLink).hasClass("ModifiedCategory"))) $(CatLink).addClass("ModifiedCategory");
            if ((OldCatName + OldDefaultSort) == (NewCatName + NewDefaultSort)) {
                $(CatLink).removeClass("ModifiedCategory");
            }
            $(CatLink).removeClass("RemovedCategory");
        } else {
            hotcat_NewCatsIndex++
            hotcat_CatNameMatrix[hotcat_NewCatsIndex] = NewCatName;
            hotcat_SortMatrix[hotcat_NewCatsIndex] = NewDefaultSort;
            var NewSpan = document.createElement('span');
            NewSpan.id = "hotcat_Span_" + hotcat_NewCatsIndex;
            NewSpan.className = "AddedCatSpan";
            CatLink = document.createElement('a');
            CatLink.id = "CatLink_" + hotcat_NewCatsIndex;
            CatLink.innerHTML = NewCatName;
            CatLink.title = hotcat_CatNamespace + NewCatName;
            CatLink.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + NewCatName);
            $(CatLink).addClass("AddedCategory");
            var RemoveLink = document.createElement('a');
            RemoveLink.innerHTML = hotcat_text_RemoveLinkText;
            RemoveLink.id = "hotcat_remove_" + hotcat_NewCatsIndex;
            RemoveLink.title = hotcat_text_RemoveLinkTitle.split("$1").join(NewCatName);
            RemoveLink.href = "javascript:hotcat_remove(\"" + NewCatName + "\"," + hotcat_NewCatsIndex + ");";
            var ModifyLink = document.createElement('a');
            ModifyLink.innerHTML = hotcat_text_ModifyLinkText;
            ModifyLink.id = "hotcat_modify_" + hotcat_NewCatsIndex;
            ModifyLink.title = hotcat_text_ModifyLinkTitle.split("$1").join(NewCatName);
            ModifyLink.href = "javascript:hotcat_modify(\"" + NewCatName + "\"," + hotcat_NewCatsIndex + ")";
            NewSpan.appendChild(CatLink);
            NewSpan.appendChild(document.createTextNode(" "));
            NewSpan.appendChild(RemoveLink);
            NewSpan.appendChild(document.createTextNode(" "));
            NewSpan.appendChild(ModifyLink);
            NewSpan.appendChild(document.createTextNode(" | "));
            TheSpan.parentNode.insertBefore(NewSpan, TheSpan);
            hotcat_SpanMatrix[hotcat_NewCatsIndex] = NewSpan;
            hotcat_CatLinkMatrix[hotcat_NewCatsIndex] = CatLink;
            hotcat_RemoveLinkMatrix[hotcat_NewCatsIndex] = RemoveLink;
            hotcat_ModifyLinkMatrix.push[hotcat_NewCatsIndex] = ModifyLink;
        }
        if (!Exist) {
            $(CatLink).addClass("new");
        } else {
            $(CatLink).removeClass("new");
        }
        var Links = TheSpan.getElementsByTagName('a');
        for (var a = 0; a < Links.length; a++) {
            Links[a].style.display = "";
        }
        TheSpan.removeChild(Form);
        hotcat_Multi_CheckForChanges();
        hotcat_upDate_FormPositions();
        if (TheSpan.id != "hotcat_add") {
            document.getElementById("hotcat_modify_" + Index).focus();
        } else {
            document.getElementById("hotcat_addlink").focus();
        }
    }
};

// ANNULATION DU FORMULAIRE

window.hotcat_cancel = function(Index) {
    var Form = hotcat_FormMatrix[Index];
    var Input = hotcat_TextMatrix[Index];
    var TheSpan = hotcat_SpanMatrix[Index];
    var CatLink = hotcat_CatLinkMatrix[Index];
    var IfExist = hotcat_ExistMatrix[Index];
    var OldCatLink = hotcat_RemoveLinkMatrix[Index];
    TheSpan.removeChild(Form);
    var Links = TheSpan.getElementsByTagName('a');
    for (a = 0; a < Links.length; a++) {
        Links[a].style.display = "";
    }
    TheSpan.firstChild.style.display = "";
    hotcat_Multi_CheckForChanges();
    hotcat_upDate_FormPositions();
    if (TheSpan.id != "hotcat_add") {
        document.getElementById("hotcat_modify_" + Index).focus();
    } else {
        document.getElementById("hotcat_addlink").focus();
    }
};

///////////////////////// ÉDITION MULTIPLE ////////////////////////////////////////////////////////

// AJOUT DU LIEN (±)

window.hotcat_append_multiedit_span = function(CatLine) {
    var FirstLink = CatLine.getElementsByTagName('a')[0];
    var Span = document.createElement('span');
    Span.id = 'hotcat_modify_multi_span';
    var Link = document.createElement('a');
    Link.id = "hotcat_modify_multi_Link";
    Link.innerHTML = hotcat_text_MultiLinkText;
    Link.title = hotcat_text_MultiLinkTitle;
    Link.href = "javascript:hotcat_multiedit_createForm();";
    Span.appendChild(Link);
    FirstLink.parentNode.insertBefore(Span, FirstLink.nextSibling);
    FirstLink.parentNode.insertBefore(document.createTextNode(" "), FirstLink.nextSibling);
    var DefaultSortSpan = document.createElement('span');
    DefaultSortSpan.id = 'hotcat_DefaultSort_span';
    var DefaultSortLink = document.createElement('a');
    DefaultSortLink.id = "hotcat_DefaultSort_Link";
    DefaultSortLink.innerHTML = hotcat_text_DefaultSortText;
    DefaultSortLink.title = hotcat_text_DefaultSortTitle;
    DefaultSortLink.href = "javascript:hotcat_defaultSort_createForm();";
    DefaultSortSpan.appendChild(DefaultSortLink);
    var OldDefaultSortSpan = document.createElement('span');
    OldDefaultSortSpan.style.display = "none";
    OldDefaultSortSpan.id = "OldDefaultSortSpan";
    DefaultSortSpan.appendChild(OldDefaultSortSpan);
    Span.parentNode.insertBefore(DefaultSortSpan, Span.nextSibling);
    Span.parentNode.insertBefore(document.createTextNode(" "), Span.nextSibling);
    if (hotcat_AutoMulti) hotcat_multiedit_createForm();
};

// CREATION DU FORMULAIRE "MULTI"

window.hotcat_multiedit_createForm = function() {
    var OldForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
    while (OldForms[0]) OldForms[0].parentNode.removeChild(OldForms[0]);
    var OldLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
    for (var a = 0; a < OldLinks.length; a++) {
        OldLinks[a].style.display = "";
    }
    for (var a = 0; a < hotcat_CatLinkMatrix.length; a++) {
        if (!hotcat_CatLinkMatrix[a]) continue;
        if (hotcat_CatLinkIsRedMatrix[a]) {
            if (!$(hotcat_CatLinkMatrix[a]).hasClass("new")) $(hotcat_CatLinkMatrix[a]).addClass("new");
        } else {
            $(hotcat_CatLinkMatrix[a]).removeClass("new");
        }
    }
    var OldSpans = document.getElementById('mw-normal-catlinks').getElementsByTagName('span');
    for (var a = 0; a < OldSpans.length; a++) {
        if (OldSpans[a].id != 'OldDefaultSortSpan') OldSpans[a].style.display = "";
    }
    if (!document.getElementById("hotcat_addlink")) hotcat_add_new(document.getElementById("hotcat_add"));
    var Legend = "";
    if (hotcat_ShowLegend) {
        Legend = '<small>' +
            '<a href="' + hotcat_docURL + '" title="' + hotcat_text_LabelTitle + '" target="_blank" ' +
            'style="color:#002BB8;padding:0.2em;margin-left:' + (hotcat_ShowInline ? 5 : 100) + 'px;">' +
            '&nbsp;<b>' + hotcat_text_LabelText + '</b>' +
            '&nbsp;<span class="RemovedCategory">' + hotcat_text_RecapRemove + '</span>' +
            '&nbsp;<span class="ModifiedCategory">' + hotcat_text_RecapModify + '</span>' +
            '&nbsp;<span class="AddedCategory">' + hotcat_text_RecapAdd + '</span>' +
            '</a>' +
            '</small>';
    }
    var BR = "";
    if (!hotcat_ShowInline) BR = "<br />";

    var RadioBoxes = "";
    if (!hotcat_Multi_IsEditPage) {
        var MinorOneChecked = ((hotcat_Minoredit == -1) ? 'checked="checked" ' : '');
        var MinorTwoChecked = ((hotcat_Minoredit == 0) ? 'checked="checked" ' : '');
        var MinorThreeChecked = ((hotcat_Minoredit == 1) ? 'checked="checked" ' : '');
        var WatchOneChecked = ((hotcat_Watchthis == -1) ? 'checked="checked" ' : '');
        var WatchTwoChecked = ((hotcat_Watchthis == 0) ? 'checked="checked" ' : '');
        var WatchThreeChecked = ((hotcat_Watchthis == 1) ? 'checked="checked" ' : '');
        RadioBoxes = '<span id="hotcat_RadioBoxes">' +
            '&nbsp;&nbsp;<span style="border:1px dotted silver;padding:0.1em;">' +
            '<input id="Minor" type="radio" name="Minor" ' + MinorOneChecked + ' style="cursor:pointer;" ' +
            'title="' + hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioDefault) + '" />' +
            '<input id="Minor_0" type="radio" name="Minor" ' + MinorTwoChecked + ' style="cursor:pointer;" ' +
            'title="' + hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioNo) + '" />' +
            '<input id="Minor-1" type="radio" name="Minor" ' + MinorThreeChecked + ' style="cursor:pointer;" ' +
            'title="' + hotcat_text_Minoredit.split("$1").join(hotcat_text_RadioYes) + '" />' +
            '</span>&nbsp;&nbsp;<span style="border:1px dotted silver;padding:0.1em;">' +
            '<input id="Watch" type="radio" name="Watch" ' + WatchOneChecked + ' style="cursor:pointer;" ' +
            'title="' + hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioDefault) + '" />' +
            '<input id="Watch0" type="radio" name="Watch" ' + WatchTwoChecked + ' style="cursor:pointer;" ' +
            'title="' + hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioNo) + '" />' +
            '<input id="Watch1" type="radio" name="Watch" ' + WatchThreeChecked + ' style="cursor:pointer;" ' +
            'title="' + hotcat_text_Watchthis.split("$1").join(hotcat_text_RadioYes) + '" />' +
            '</span>' +
            '</span>';
    }

    var Link = document.getElementById('hotcat_modify_multi_Link');
    var Span = Link.parentNode;
    var Form = document.createElement('form');
    Form.id = "hotcat_modify_multi_form";
    Form.style.display = "inline";
    Form.innerHTML = '' +
        Legend +
        BR +
        '<input id="hotcat_modify_multi_InputOK" type="button" disabled="disabled" ' +
        'value="' + hotcat_text_MultiInputOK + '" ' +
        'onclick="hotcat_multiedit_FormOK()" onselect="hotcat_multiedit_FormOK()" />' +
        '<input id="hotcat_modify_multi_InputCancel" type="button" ' +
        'value="' + hotcat_text_MultiInputCancel + '" ' +
        'onclick="hotcat_multiedit_CancelForm()" onselect="hotcat_multiedit_CancelForm()" />' +
        RadioBoxes +
        BR;
    Span.appendChild(Form);
    Link.style.display = "none";
    hotcat_Multi_Edit = true;
    if (!hotcat_AutoMulti) document.getElementById("hotcat_modify_multi_InputCancel").focus();
};

// ANNULATION DU FORMULAIRE "MULTI" + MODIFICATION DES LIENS, FONCTIONS ET IDS DE LA BARRE DE CATÉGORIES

window.hotcat_multiedit_CancelForm = function() {
    var Link = document.getElementById('hotcat_modify_multi_Link');
    var Form = document.getElementById('hotcat_modify_multi_form');
    if (Link) Link.style.display = "inline";
    var CatForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
    while (CatForms[0]) {
        CatForms[0].parentNode.removeChild(CatForms[0]);
    }
    var CatSpans = document.getElementById('mw-normal-catlinks').getElementsByTagName('span');
    var SpanToRemove = [];
    for (var a = 1; a < CatSpans.length; a++) {
        if ($(CatSpans[a]).hasClass("AddedCatSpan")) SpanToRemove.push(CatSpans[a]);
    }
    for (var a = 0; a < SpanToRemove.length; a++) {
        SpanToRemove[a].parentNode.removeChild(SpanToRemove[a]);
    }
    var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
    for (var a = 0; a < CatLinks.length; a++) {
        CatLinks[a].style.display = "inline";
        $(CatLinks[a]).removeClass("RemovedCategory");
        if ($(CatLinks[a]).hasClass("ModifiedCategory")) {
            var Index = hotcat_getIndex(CatLinks[a]);
            var Parent = CatLinks[a].parentNode;
            var OldCatName = hotcat_CatNameMatrix[Index];
            var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
            hotcat_SortMatrix[Index] = OldDefaultSort;
            CatLinks[a].innerHTML = OldCatName;
            CatLinks[a].title = hotcat_CatNamespace + OldCatName;
            CatLinks[a].href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(hotcat_CatNamespace + OldCatName);
            $(CatLinks[a]).removeClass("ModifiedCategory");
        }
        if ($(CatLinks[a]).hasClass("ModifiedDefaultSort")) {
            var DefaultSortSpan = document.getElementById("OldDefaultSortSpan");
            DefaultSortSpan.innerHTML = hotcat_OldDefaultSort;
            $(CatLinks[a]).removeClass("ModifiedDefaultSort");
        }
    }
    for (var a = 0; a < hotcat_CatLinkMatrix.length; a++) {
        if (!hotcat_CatLinkMatrix[a]) continue;
        if (hotcat_CatLinkIsRedMatrix[a]) {
            if (!$(hotcat_CatLinkMatrix[a]).hasClass("new")) $(hotcat_CatLinkMatrix[a]).addClass("new");
        } else {
            $(hotcat_CatLinkMatrix[a]).removeClass("new");
        }
    }
    hotcat_Multi_Edit = false;
    Link.focus();
};

// VALIDATION DU FORMULAIRE "MULTI" + LISTING DES CATÉGORIES À ENLEVER/MODIFIER/AJOUTER

window.hotcat_multiedit_FormOK = function() {
    var RemovedCategories = [];
    var ModifiedCategories_from = [];
    var ModifiedCategories_to = [];
    var AddedCategories = [];
    var DefaultSort = hotcat_OldDefaultSort;
    var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
    for (var a = 0; a < CatLinks.length; a++) {
        var Link = CatLinks[a];
        var Index = hotcat_getIndex(Link);
        if ($(Link).hasClass("RemovedCategory")) {
            RemovedCategories.push(Link.innerHTML.ucFirst());
        }
        if ($(Link).hasClass("ModifiedCategory")) {
            var NewCatName = Link.innerHTML.ucFirst();
            var OldCatName = hotcat_CatNameMatrix[Index];
            var OldDefaultSort = hotcat_defaultSort_getOneOld(OldCatName);
            var NewDefaultSort = hotcat_SortMatrix[Index];
            if ((OldCatName + OldDefaultSort) != (NewCatName + NewDefaultSort)) {
                ModifiedCategories_from.push((OldCatName + OldDefaultSort));
                ModifiedCategories_to.push((NewCatName + NewDefaultSort));
            }
        }
        if ($(Link).hasClass("AddedCategory")) {
            var NewDefaultSort = hotcat_SortMatrix[Index];
            AddedCategories.push(Link.innerHTML.ucFirst() + NewDefaultSort);
        }
        if ($(Link).hasClass("ModifiedDefaultSort")) {
            var DefaultSortSpan = document.getElementById("OldDefaultSortSpan");
            DefaultSort = DefaultSortSpan.innerHTML;
        }
    }
    var RadioBoxesSpan = document.getElementById("hotcat_RadioBoxes");
    var RecapMinor = '';
    var RecapWatch = '';
    var Newhotcat_Minoredit = false;
    var Newhotcat_Watchthis = false;
    if (RadioBoxesSpan) {
        var RadioBoxes = RadioBoxesSpan.getElementsByTagName('input');
        for (var a = 0; a < RadioBoxes.length; a++) {
            if (RadioBoxes[a].type != "radio") continue;
            if (!RadioBoxes[a].checked) continue;
            var BoxName = RadioBoxes[a].name;
            var Number = hotcat_getIndex(RadioBoxes[a]);
            if (BoxName == "Minor") {
                var Minor = -1;
                var TextMinor = hotcat_text_RadioDefault;
                if (Number == 0) {
                    Minor = Number;
                    TextMinor = hotcat_text_RadioNo;
                } else if (Number == 1) {
                    Minor = Number;
                    TextMinor = hotcat_text_RadioYes;
                }
                Newhotcat_Minoredit = Minor;
                RecapMinor += hotcat_text_Minoredit.split("$1").join(TextMinor) + '\n';
            } else if (BoxName == "Watch") {
                var Watch = -1;
                var TextWatch = hotcat_text_RadioDefault;
                if (Number == 0) {
                    Watch = Number;
                    TextWatch = hotcat_text_RadioNo;
                } else if (Number == 1) {
                    Watch = Number;
                    TextWatch = hotcat_text_RadioYes;
                }
                Newhotcat_Watchthis = Watch;
                RecapWatch += hotcat_text_Watchthis.split("$1").join(TextWatch) + '\n';
            }
        }
    }
    var TextrecapTitle = hotcat_text_RecapTitle + '\n\n';
    var TextRecap = TextrecapTitle;
    if (RemovedCategories[0]) {
        TextRecap += hotcat_text_RecapRemove + ' :\n';
        for (var a = 0; a < RemovedCategories.length; a++) {
            TextRecap += '* « ' + RemovedCategories[a] + ' »\n';
        }
    }
    if (ModifiedCategories_to[0]) {
        TextRecap += hotcat_text_RecapModify + ' :\n';
        for (var a = 0; a < ModifiedCategories_to.length; a++) {
            TextRecap += '* « ' + ModifiedCategories_from[a] + ' » -> « ' + ModifiedCategories_to[a] + ' »\n';
        }
    }
    if (AddedCategories[0]) {
        TextRecap += hotcat_text_RecapAdd + ' :\n';
        for (var a = 0; a < AddedCategories.length; a++) {
            TextRecap += '* « ' + AddedCategories[a] + ' »\n';
        }
    }
    if (DefaultSort != hotcat_OldDefaultSort) {
        TextRecap += hotcat_text_RecapSort + ' :\n';
        TextRecap += '* « ' + hotcat_OldDefaultSort + ' » -> « ' + DefaultSort + ' »\n';
    }
    if (TextRecap == TextrecapTitle) return;
    TextRecap += RecapMinor;
    TextRecap += RecapWatch;
    if (hotcat_SkipRecap || confirm(TextRecap)) {
        hotcat_Minoredit = Newhotcat_Minoredit;
        hotcat_Watchthis = Newhotcat_Watchthis;
        hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
    }
};

// VÉRIFICATION DES CHANGEMENTS EFFECTUÉS

window.hotcat_Multi_CheckForChanges = function() {
    if (!hotcat_Multi_Edit) return;
    var CatLinks = document.getElementById('mw-normal-catlinks').getElementsByTagName('a');
    var AnythingChanged = false;
    for (var a = 0; a < CatLinks.length; a++) {
        var Link = CatLinks[a];
        if (($(Link).hasClass("RemovedCategory")) || ($(Link).hasClass("ModifiedCategory")) || ($(Link).hasClass("AddedCategory")) || ($(Link).hasClass("ModifiedDefaultSort"))) {
            AnythingChanged = true;
        }
    }
    if (AnythingChanged) {
        document.getElementById('hotcat_modify_multi_InputOK').disabled = "";
    } else {
        document.getElementById('hotcat_modify_multi_InputOK').disabled = "disabled";
    }
};

///////////////////////// CLEFS DE TRI ////////////////////////////////////////////////////////

// RÉCUPÉRATION CLEF DE TRI GLOBALE

window.hotcat_defaultSort_getOld = function(ID) {
    var OldDefaultSpan = document.getElementById(ID);
    if (!OldDefaultSpan) return;
    var Page = hotcat_OldPageContent;
    for (var a = 0; a < hotcat_DefaultsortAliases.length; a++) {
        if (Page.indexOf('{{' + hotcat_DefaultsortAliases[a] + ':') != -1) {
            var AvantCle = Page.substring(0, Page.indexOf('{{' + hotcat_DefaultsortAliases[a] + ':'));
            var Cle = Page.split(AvantCle).join('');
            Cle = Cle.substring(0, Cle.indexOf("}"));
            Cle = Cle.substring((Cle.indexOf(":") + 1), Cle.length);
            hotcat_OldDefaultSort = Cle;
            OldDefaultSpan.innerHTML = hotcat_OldDefaultSort;
            return;
        }
    }
};

// RÉCUPÉRATION CLEF DE TRI PARTICULIÈRE

window.hotcat_defaultSort_getOneOld = function(TargetCategory) {
    var Page = hotcat_OldPageContent;
    var Key = "";
    var CurrentKey = "";
    var REGEXP = new RegExp("(\\s*)\\[\\[ *(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category) *: *" + TargetCategory.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
    var matches = Page.match(REGEXP);
    if (matches != null && matches.length == 1) {
        CurrentKey = Page.replace(REGEXP, "DEFAULTKEYstart$2DEFAULTKEYend");
        if ((CurrentKey.indexOf("DEFAULTKEYstart") != -1) && (CurrentKey.indexOf("DEFAULTKEYend") != -1)) {
            var Before = CurrentKey.split("DEFAULTKEYstart")[0] + "DEFAULTKEYstart";
            var After = "DEFAULTKEYend" + CurrentKey.split("DEFAULTKEYend")[1];
            CurrentKey = CurrentKey.split(Before).join("");
            CurrentKey = CurrentKey.split(After).join("");
            if (CurrentKey.indexOf('|') != -1) Key = CurrentKey;
        }
    }
    return Key;
};

// CRÉATION FORMULAIRE CLEF DE TRI GLOBALE

window.hotcat_defaultSort_createForm = function() {
    hotcat_defaultSort_getOld("OldDefaultSortSpan");
    var thespan = document.getElementById('hotcat_DefaultSort_span');
    var OldDefaultSort = thespan.getElementsByTagName('span')[0].innerHTML;
    thespan.getElementsByTagName('a')[0].style.display = "none";
    var form = document.createElement("form");
    form.id = "hotcat_form_Default";
    form.method = "post";
    form.onsubmit = function() {
        hotcat_Default_ok(this);
        return false;
    };
    form.style.display = "inline";
    var text = document.createElement("input");
    text.size = 40;
    text.id = "hotcat_text_Default";
    text.type = "text";
    text.value = OldDefaultSort;
    var OK = document.createElement("input");
    OK.type = "button";
    OK.value = hotcat_text_InputOK;
    OK.onclick = function() {
        hotcat_Default_ok(this.parentNode);
    };
    var cancel = document.createElement("input");
    cancel.type = "button";
    cancel.value = hotcat_text_InputCancel;
    cancel.onclick = function() {
        var Form = this.parentNode;
        hotcat_Default_Cancel(Form);
    };
    form.appendChild(text);
    form.appendChild(OK);
    form.appendChild(cancel);
    thespan.appendChild(form);
    hotcat_upDate_FormPositions();
    text.focus();
};

// ANNULATION FORMULAIRE CLEF DE TRI GLOBALE

window.hotcat_Default_Cancel = function(Form) {
    var Span = Form.parentNode;
    Form.parentNode.getElementsByTagName('a')[0].style.display = "";
    Form.parentNode.removeChild(Form);
    if (hotcat_Multi_Edit) {
        Span.getElementsByTagName('span')[0].innerHTML = hotcat_OldDefaultSort;
        $(Span.getElementsByTagName('a')[0]).removeClass("ModifiedDefaultSort");
        Span.getElementsByTagName('a')[0].style.display = "";
        hotcat_Multi_CheckForChanges();
    }
    document.getElementById("hotcat_DefaultSort_Link").focus();
};

// VALIDATION FORMULAIRE CLEF DE TRI GLOBALE

window.hotcat_Default_ok = function(Form) {
    var Text = document.getElementById("hotcat_text_Default");
    var OldDefaultSort = hotcat_OldDefaultSort;
    var NewDefaultSort = Text.value;
    if (!hotcat_Multi_Edit) {
        if (OldDefaultSort == NewDefaultSort) {
            hotcat_Default_Cancel(Form);
            return;
        } else {
            var RemovedCategories = [];
            var ModifiedCategories_from = [];
            var ModifiedCategories_to = [];
            var AddedCategories = [];
            var DefaultSort = NewDefaultSort;
            hotcat_Edit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
        }
    } else {
        if (OldDefaultSort == NewDefaultSort) {
            hotcat_Default_Cancel(Form);
            return;
        } else {
            var Span = Form.parentNode;
            Span.getElementsByTagName('span')[0].innerHTML = Text.value;
            var Link = Span.getElementsByTagName('a')[0];
            Link.style.display = "";
            $(Link).addClass("ModifiedDefaultSort");
            Form.parentNode.removeChild(Form);
            hotcat_Multi_CheckForChanges();
            hotcat_upDate_FormPositions();
            document.getElementById("hotcat_DefaultSort_Link").focus();
        }
    }
};

///////////////////////// ÉDITION ////////////////////////////////////////////////////////

window.hotcat_Edit = function(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort) {
    if (hotcat_Multi_IsEditPage) {
        hotcat_autocommit = false;
        hotcat_DoEdit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
        hotcat_multiedit_CancelForm();
        return;
    }
    var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit';
    hotcat_ajax.http({
        url: URL,
        onSuccess: hotcat_TrueEdit,
        removedcats: RemovedCategories,
        modifiedcatsfrom: ModifiedCategories_from,
        modifiedcatsto: ModifiedCategories_to,
        addedcats: AddedCategories,
        defaultsort: DefaultSort
    });
};

window.hotcat_TrueEdit = function(Req, data) {
    var RemovedCategories = data.removedcats;
    var ModifiedCategories_from = data.modifiedcatsfrom;
    var ModifiedCategories_to = data.modifiedcatsto;
    var AddedCategories = data.addedcats;
    var DefaultSort = data.defaultsort;
    while (document.body.firstChild) {
        document.body.removeChild(document.body.firstChild);
    }
    document.body.innerHTML = Req.responseText;
    hotcat_DoEdit(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort);
};

window.hotcat_DoEdit = function(RemovedCategories, ModifiedCategories_from, ModifiedCategories_to, AddedCategories, DefaultSort) {
    var prevent_autocommit = 0;
    if (typeof(hotcat_EditCustom) == "function") hotcat_EditCustom();
    if (hotcat_autocommit) document.editform.style.display = "none";
    for (var a = 0, l = ModifiedCategories_to.length; a < l; a++) {
        ModifiedCategories_to[a] = ModifiedCategories_to[a].replace(new RegExp("^" + hotcat_CatNamespace, "ig"), "");
    }
    for (var a = 0, l = AddedCategories.length; a < l; a++) {
        AddedCategories[a] = AddedCategories[a].replace(new RegExp("^" + hotcat_CatNamespace, "ig"), "");
    }
    var OldText = document.getElementById('wpTextbox1').value;
    var summary = [];
    for (var a = 0; a < RemovedCategories.length; a++) {
        var OldCatName = RemovedCategories[a];
        var OldCatNameUnsorted = OldCatName.replace(/\|.*/, "");
        var REGEXP = new RegExp("(\\s*)\\[\\[ *(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category) *: *" + OldCatName.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
        var matchesCatName = OldText.match(REGEXP);
        if (matchesCatName != null && matchesCatName.length == 1) {
            OldText = OldText.replace(REGEXP, "");
            summary.push(" – [[" + hotcat_CatNamespace + OldCatNameUnsorted + "]]");
        } else {
            prevent_autocommit = 1;
            if (matchesCatNameUnsorted == null) {
                alert(hotcat_text_AlertProblem1.split('$1').join(OldCatNameUnsorted));
            } else if (matchesCatNameUnsorted.length > 1) {
                alert(hotcat_text_AlertProblem3.split('$1').join(OldCatNameUnsorted));
            }
        }
    }
    if ((RemovedCategories[0]) && ((ModifiedCategories_from[0]) || (AddedCategories[0]))) summary.push(" |");
    for (var a = 0; a < ModifiedCategories_from.length; a++) {
        var OldCatName = ModifiedCategories_from[a];
        var OldCatNameUnsorted = OldCatName.replace(/\|.*/, "");
        var NewCatName = ModifiedCategories_to[a];
        var NewCatNameUnsorted = NewCatName.replace(/\|.*/, "");
        var REGEXP_OLD = hotcat_CreateRegExp(OldCatName);
        var REGEXP_NEW = hotcat_CreateRegExp(NewCatNameUnsorted);
        var matchesOldCatName = OldText.match(REGEXP_OLD);
        var matchesNewCatName = OldText.match(REGEXP_NEW);
        if (((matchesNewCatName == null) || (OldCatNameUnsorted == NewCatNameUnsorted)) && matchesOldCatName != null && matchesOldCatName.length == 1) {
            OldText = OldText.replace(REGEXP_OLD, "$1[[" + hotcat_CatNamespace + NewCatName + "$6]]");
            summary.push(" ± [[" + hotcat_CatNamespace + OldCatNameUnsorted + "]]->[[" + hotcat_CatNamespace + NewCatNameUnsorted + "]]");
        } else {
            prevent_autocommit = 1;
            if (matchesOldCatName == null) {
                alert(hotcat_text_AlertProblem1.split('$1').join(OldCatNameUnsorted));
            } else if (matchesOldCatName.length > 1) {
                alert(hotcat_text_AlertProblem3.split('$1').join(OldCatNameUnsorted));
            } else if ((matchesNewCatName != null) && (OldCatNameUnsorted != NewCatNameUnsorted)) {
                alert(hotcat_text_AlertProblem2.split('$1').join(NewCatNameUnsorted));
            }
        }
    }
    if ((AddedCategories[0]) && (ModifiedCategories_from[0])) summary.push(" |");
    for (var a = 0; a < AddedCategories.length; a++) {
        var NewCatName = AddedCategories[a];
        var NewCatNameUnsorted = NewCatName.replace(/\|.*/, "");
        var REGEXP = hotcat_CreateRegExp(NewCatNameUnsorted);
        var matchesCatNameUnsorted = OldText.match(REGEXP);
        if (matchesCatNameUnsorted != null) {
            alert(hotcat_text_AlertProblem2.split('$1').join(NewCatNameUnsorted));
            prevent_autocommit = 1;
            continue;
        }
        var re = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig")
        var index = -1;
        while (re.exec(OldText) != null) index = re.lastIndex;
        var txt = "[[" + hotcat_CatNamespace + NewCatName + "]]";
        if (index < 0) { // no category
            var interWiki = new RegExp('^\\s*\\[\\[([a-z][a-z].?(x?-[^\\]]+)?|simple|tokipona):([^\\]]*)\\]\\]\\s*$');
            var blank = new RegExp('^\\s*$');
            var lines = OldText.split('\n');
            var DebutModele = '';
            var SuiteModele = '';
            for (var lineId = lines.length - 1; lineId >= 0; --lineId) {
                if (!interWiki.test(lines[lineId]) && !blank.test(lines[lineId])) {
                    DebutModele = lines.slice(0, lineId + 1).join('\n') + '\n\n';
                    SuiteModele = lines.slice(lineId + 1).join('\n');
                    break;
                }
            }
            if (DebutModele === '') {
                // edge case: source has nothing else than interwikis
                SuiteModele = OldText;
            }
            while (SuiteModele.indexOf('\n\n') != -1) {
                SuiteModele = SuiteModele.split("\n\n").join("\n");
            }
            SuiteModele = SuiteModele.replace(/^\n/, "");
            OldText = DebutModele + txt + '\n\n' + SuiteModele;
        } else {
            OldText = OldText.substring(0, index) + '\n' + txt + OldText.substring(index);
        }
        summary.push(" + [[" + hotcat_CatNamespace + NewCatNameUnsorted + "]]");
    }
    if ((DefaultSort != hotcat_OldDefaultSort) && (DefaultSort != "undefined")) {
        var NewDefaultSort = "{{DEFAULTSORT:" + DefaultSort + "}}\n";
        var HasDefaultSort = null;
        for (var d = 0; d < hotcat_DefaultsortAliases.length; d++) {
            if (OldText.indexOf(hotcat_DefaultsortAliases[d]) != -1) HasDefaultSort = hotcat_DefaultsortAliases[d] + ":";
        }
        if (HasDefaultSort != null) {
            if (DefaultSort == "") {
                NewDefaultSort = "";
                summary.push(";  – {{DEFAULTSORT:" + hotcat_OldDefaultSort + "}}");
            } else {
                summary.push(";  ± {{DEFAULTSORT:}} : " + hotcat_OldDefaultSort + " -> " + DefaultSort);
            }
            OldText = OldText.split("{{" + HasDefaultSort + hotcat_OldDefaultSort + "}}\n").join(NewDefaultSort);
            OldText = OldText.split("{{" + HasDefaultSort + hotcat_OldDefaultSort + "}}").join(NewDefaultSort);
        } else if (DefaultSort != "") {
            var re = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig");
            var index = re.exec(OldText);
            if (index == null) {
                var interWiki = new RegExp('^\\s*\\[\\[([a-z][a-z].?(x?-[^\\]]+)?|simple|tokipona):([^\\]]*)\\]\\]\\s*$');
                var blank = new RegExp('^\\s*$');
                var lines = OldText.split('\n');
                var DebutModele = '';
                var SuiteModele = '';
                for (var lineId = lines.length - 1; lineId >= 0; --lineId) {
                    if (!interWiki.test(lines[lineId]) && !blank.test(lines[lineId])) {
                        DebutModele = lines.slice(0, lineId + 1).join('\n') + '\n\n';
                        SuiteModele = lines.slice(lineId + 1).join('\n');
                        break;
                    }
                }
                if (DebutModele === '') {
                    // edge case: source has nothing else than interwikis
                    SuiteModele = OldText;
                }
                SuiteModele = SuiteModele.replace(/^\n/, "");
                OldText = DebutModele + NewDefaultSort + '\n' + SuiteModele;
            } else {
                var lastindex = (re.lastIndex);
                var compile = re.compile(re);
                var FirstCat = re.exec(OldText).toString();
                FirstCat = FirstCat.replace(/\n/g, "");
                var Before = OldText.substring(0, lastindex).replace(FirstCat, "");
                var After = FirstCat + OldText.substring(lastindex);
                OldText = Before + NewDefaultSort + After;
            }
            summary.push(";  + " + NewDefaultSort);
        }
    }
    var cat = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig");
    var nocat1 = "{{" + hotcat_text_NoCatTemplate.ucFirst() + "}}\n";
    var nocat1Bis = "{{" + hotcat_text_NoCatTemplate.lcFirst() + "}}\n";
    var nocat2 = "{{" + hotcat_text_NoCatTemplate.ucFirst() + "}}";
    var nocat2Bis = "{{" + hotcat_text_NoCatTemplate.lcFirst() + "}}";
    if (cat.exec(OldText) != null) {
        OldText = OldText.split(nocat1).join("");
        OldText = OldText.split(nocat1Bis).join("");
        OldText = OldText.split(nocat2).join("");
        OldText = OldText.split(nocat2Bis).join("");
    }
    document.getElementById('wpTextbox1').value = OldText;
    document.getElementById('wpSummary').value = hotcat_text_ResumeScript + summary.join("");
    if (!hotcat_Multi_IsEditPage) {
        if (hotcat_Minoredit == 1) document.editform.wpMinoredit.checked = true;
        if (hotcat_Minoredit == 0) document.editform.wpMinoredit.checked = false;
        if (hotcat_Watchthis == 1) document.editform.wpWatchthis.checked = true;
        if (hotcat_Watchthis == 0) document.editform.wpWatchthis.checked = false;
    }
    if ((hotcat_autocommit) && (prevent_autocommit != 1)) {
        var watchthisparam = {};
        watchthisparam[-1] = "nochange";
        watchthisparam[0] = "unwatch";
        watchthisparam[1] = "watch";
        var datas = {
            action: 'edit',
            title: mw.config.get('wgPageName'),
            text: OldText,
            summary: hotcat_text_ResumeScript + summary.join(""),
            watchlist: watchthisparam[hotcat_Watchthis],
            token: document.editform.wpEditToken.value
        };
        if (document.editform.wpMinoredit.checked) {
            datas['minor'] = 1;
        }
        var hotcattag = hotcat_gettag();
        if (hotcattag) {
            datas.summary = summary.join("");
            datas.tags = hotcattag;
        }
        var api = new mw.Api();
        api.post(datas, {
            'contentType': 'application/x-www-form-urlencoded'
        }).then(function(data) {
            window.location.reload();
        });
        return;
    }
    if (prevent_autocommit == 1) document.editform.style.display = "";
    if (hotcat_Multi_IsEditPage) hotcat_update_existing();
};

///////////////////////// SUGGESTIONS ////////////////////////////////////////////////////////

// REQUÊTE DE SUGGESTIONS

window.hotcat_text_changed = function(FormIndex, Mode, titles, catContinue) {
    if (hotcat_suggest_running) return;
    if (!Mode) Mode = false;
    if ((!FormIndex) || (FormIndex == "")) FormIndex = "0";
    if (!titles) titles = [];
    if (!catContinue) catContinue = "";
    var text = hotcat_TextMatrix[FormIndex];
    if (!text) {
        alert('PB hotcat_text_changed () : ' + FormIndex);
        return;
    }
    var v = text.value;
    v = hotcat_deleteUnwantedUnicodeChars(v);
    v = v.replace(new RegExp("^" + hotcat_CatNamespace, "ig"), "");
    v = v.ucFirst();
    text.value = v;
    if (v.indexOf("|") != -1) v = v.split("|")[0];
    var APILimit = (((mw.config.get('wgUserGroups').indexOf("sysop") != -1) || (mw.config.get('wgUserGroups').indexOf("bot") != -1)) ? 4999 : 499);
    if (hotcat_list_items > APILimit) hotcat_list_items = APILimit; // API max
    if (Mode == "UP") { // Suggestions catégories-mères
        var URL = "/api.php?format=xml&action=query&prop=categories&titles=" + hotcat_CatNamespace + encodeURIComponent(v) + "&cllimit=" + hotcat_list_items;
        var TagName = "cl";
        var Replace = false;
    } else if (Mode == "DOWN") { // Suggestions catégories-filles
        var URL = "/api.php?format=xml&action=query&list=categorymembers&cmnamespace=14&cmtitle=" + hotcat_CatNamespace + encodeURIComponent(v) + "&cmlimit=" + APILimit + catContinue;
        var TagName = "cm";
        var Replace = false;
    } else { // Suggestions normales
        var URL = "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent(v) + "&aplimit=" + hotcat_list_items;
        var TagName = "p";
        var Replace = true;
    }
    hotcat_suggest_running = 1;
    if (v != "") {
        hotcat_ajax.http({
            url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + URL,
            onSuccess: hotcat_text_changedBis,
            tagname: TagName,
            replacetext: Replace,
            titles: titles,
            formindex: FormIndex,
            mode: Mode
        });
    } else {
        hotcat_show_suggestions(titles, FormIndex, Replace);
    }
};

window.hotcat_text_changedBis = function(Req, data) {
    var titles = data.titles;
    var FormIndex = data.formindex;
    var Mode = data.mode;
    var TagName = data.tagname;
    var Replace = data.replacetext;
    var xml = Req.responseXML;
    if (xml == null) return;
    var pages = xml.getElementsByTagName(TagName);
    for (var i = 0; i < pages.length; i++) {
        var s = pages[i].getAttribute("title");
        if (s.indexOf(hotcat_CatNamespace) != -1) {
            s = s.split(hotcat_CatNamespace).join('');
            titles.push(s);
        }
    }
    var CanContinue = xml.getElementsByTagName("query-continue")[0];
    if (Mode == "DOWN" && CanContinue) {
        CanContinueId = "&cmcontinue=" + encodeURIComponent(CanContinue.firstChild.getAttribute("cmcontinue"));
        hotcat_suggest_running = 0;
        hotcat_text_changed(FormIndex, Mode, titles, CanContinueId);
    } else {
        hotcat_show_suggestions(titles, FormIndex, Replace);
    }
};

// AFFICHAGE DES SUGGESTIONS

window.hotcat_show_suggestions = function(titles, FormIndex, Replace, Mode) {
    hotcat_suggest_running = 0;
    var text = hotcat_TextMatrix[FormIndex];
    var list = hotcat_ListMatrix[FormIndex];
    var icon = hotcat_ExistMatrix[FormIndex];
    if ((!text) || (!list) || (!icon)) {
        alert('PB hotcat_show_suggestions() : ' + FormIndex);
        return;
    }
    if (titles.length == 0) {
        list.style.display = "none";
        if (Replace) {
            icon.src = hotcat_exists_no;
            icon.title = hotcat_text_Exists_NoTitle;
        }
        return;
    }
    var TailleListe = hotcat_list_size;
    if (titles.length < TailleListe) TailleListe = titles.length;
    var listh = TailleListe * 20;
    list.size = 5;
    list.style.align = "left";
    list.style.zIndex = 5;
    list.style.position = "relative";
    list.style.width = text.offsetWidth + "px";
    list.style.height = listh + "px";
    while (list.firstChild) list.removeChild(list.firstChild);
    for (var i = 0; i < titles.length; i++) {
        var opt = document.createElement("option");
        var ot = document.createTextNode(titles[i]);
        opt.appendChild(ot);
        opt.value = titles[i];
        list.appendChild(opt);
    }
    if (hotcat_list_down) {
        list.style.top = parseInt(text.offsetHeight) + "px";
        list.style.marginBottom = "-" + (listh + parseInt(text.offsetHeight)) + "px";
    } else {
        list.style.marginTop = "-" + listh + "px";
        list.style.display = "inline";
        $(list).position({
            my: "left bottom",
            at: "left top",
            collision: "none",
            of: $(text)
        });
    }
    list.style.marginLeft = "-" + text.offsetWidth + "px";
    list.onkeyup = hotcat_KeypressedOnList;
    list.style.display = "inline";
    icon.title = hotcat_text_Exists_YesTitle;
    icon.src = hotcat_exists_yes;
    var first_title = titles.shift();
    hotcat_last_v = text.value.ucFirst();
    var hotcat_last_v_Split = hotcat_last_v;
    if (hotcat_last_v.indexOf('|') != -1) {
        hotcat_last_key = hotcat_last_v.substring(hotcat_last_v.indexOf("|"), hotcat_last_v.length);
        hotcat_last_v_Split = hotcat_last_v.split(hotcat_last_key).join('');
    } else {
        hotcat_last_key = "";
    }
    if (first_title == hotcat_last_v_Split) return;
    if (Replace) {
        var suggestion = first_title;
        if (suggestion.indexOf(hotcat_last_v_Split) == -1) {
            icon.src = hotcat_exists_no;
            icon.title = hotcat_text_Exists_NoTitle;
            return;
        }
        text.value = suggestion + hotcat_last_key;
        if (text.createTextRange) {
            var ra = text.createTextRange();
            ra.moveStart("character", hotcat_last_v.length);
            ra.moveEnd("character", suggestion.length);
            ra.select();
        } else if (text.setSelectionRange) {
            text.setSelectionRange(hotcat_last_v.length, suggestion.length);
        } else {
            text.selectionStart = hotcat_last_v.length;
            text.selectionEnd = suggestion.length;
        }
    } else {
        list.focus();
    }
};

// MISE A JOUR DE LA POSITION DES LISTES DE SUGGESTIONS

window.hotcat_upDate_FormPositions = function() {
    var AllForms = document.getElementById('mw-normal-catlinks').getElementsByTagName('form');
    for (var a = 0; a < AllForms.length; a++) {
        if (AllForms[a].id == "hotcat_modify_multi_form") continue;
        if (AllForms[a].id == "hotcat_form_Default") continue;
        var ThisForm = AllForms[a];
        var ThisSelect = ThisForm.getElementsByTagName('select')[0];
        var Options = ThisSelect.getElementsByTagName('option');
        var ThisInput = ThisForm.getElementsByTagName('input')[0];
        var ListHeight = hotcat_list_size * 20;
        if (Options.length < hotcat_list_size) {
            ListHeight = Options.length * 20;
        }
        if (hotcat_list_down) {
            ThisSelect.style.top = parseInt(ThisInput.offsetHeight) + "px";
            ThisSelect.style.marginBottom = "-" + (ListHeight + parseInt(ThisInput.offsetHeight)) + "px";
        } else {
            ThisSelect.style.marginTop = "-" + ListHeight + "px";
        }
        ThisSelect.style.marginLeft = "-" + ThisInput.offsetWidth + "px";
    }
};

// SÉLECTION D'UNE SUGGESTION AU CLAVIER

window.hotcat_KeypressedOnList = function(e) {
    if (!e) var e = window.event;
    if (e.keyCode != 13) return;
    hotcat_text_replace(hotcat_getIndex(this));
};

// REMPLACEMENT DU CHAMP DE TEXTE PAR UNE SUGGESTION

window.hotcat_text_replace = function(Index) {
    var Text = hotcat_TextMatrix[Index];
    var TextValue = Text.value;
    var List = hotcat_ListMatrix[Index];
    var Options = List.getElementsByTagName('option');
    for (var a = 0; a < Options.length; a++) {
        if (Options[a].selected) {
            var ListValue = Options[a].value;
            if (TextValue.indexOf('|') != -1) {
                hotcat_last_key = TextValue.substring(TextValue.indexOf("|"), TextValue.length);
            }
            Text.value = ListValue + hotcat_last_key;
            hotcat_text_changed(Index);
            Text.focus();
            return;
        }
    }
};

///////////////////////// MISE A JOUR BARRE DE CATÉGORIES ////////////////////////////////////////////////////////

window.hotcat_update_existing = function() {
    var OldText = document.getElementById("wpTextbox1").value;
    OldText = hotcat_update_existing_Strip(OldText);
    var catRegExp = new RegExp("\\[\\[(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):[^\\]]+\\]\\]", "ig");
    var Matches = OldText.match(catRegExp);
    var Cats = [];
    if (Matches != null) {
        for (var a = 0, l = Matches.length; a < l; a++) {
            var ThisMatch = Matches[a];
            ThisMatch = ThisMatch.replace(new RegExp("\\[\\[(" + mw.config.get('wgFormattedNamespaces')[14] + "|Category):", "ig"), "");
            ThisMatch = ThisMatch.replace(new RegExp("\\]\\]", "ig"), "");
            var ThisCat = ThisMatch.replace(/\|.*/g, "");
            Cats.push(ThisCat);
        }
    }
    hotcat_update_existing_Exists(Cats);
};

window.hotcat_update_existing_Strip = function(Text) {
    Text = hotcat_update_existing_StripTag(Text, "<nowiki[^>]*>", "</" + "nowiki>");
    Text = hotcat_update_existing_StripTag(Text, "<includeonly[^>]*>", "</" + "includeonly>");
    Text = hotcat_update_existing_StripTag(Text, "<pre[ ]+[^>]*>", "</" + "pre>");
    Text = hotcat_update_existing_StripTag(Text, "<source[ ]+[^>]*>", "</" + "source>");
    Text = hotcat_update_existing_StripTag(Text, "<syntaxhighlight[ ]*[^>]*>", "</" + "syntaxhighlight>");
    Text = hotcat_update_existing_StripTag(Text, "<!--[\\-]*", "-->");
    return Text;
};

window.hotcat_update_existing_StripTag = function(Text, StartTag, EndTag) {
    var TagRegExp = new RegExp(StartTag, "ig");
    var Matches = Text.match(TagRegExp);
    if (Matches != null) {
        for (var a = 0, l = Matches.length; a < l; a++) {
            var BeforeTag = Text.substring(0, Text.indexOf(Matches[a]));
            var AfterTag = Text.substring(BeforeTag.length, Text.length);
            if (AfterTag.indexOf(EndTag) == -1) {
                AfterTag = "";
            } else {
                AfterTag = AfterTag.substring((AfterTag.indexOf(EndTag) + (EndTag.length)), AfterTag.length);
            }
            Text = BeforeTag + AfterTag;
            if (Text.match(TagRegExp) == null) break;
        }
    }
    return Text;
};

window.hotcat_update_existing_Exists = function(Cats, NewCats) {
    if (!Cats[0]) {
        hotcat_update_existing_Update(Cats, NewCats);
        return;
    }
    if (!NewCats) NewCats = [];
    var CatTitles = [];
    for (var a = 0, l = Cats.length; a < l; a++) {
        CatTitles.push(mw.config.get('wgFormattedNamespaces')[14] + ":" + encodeURIComponent(Cats[a]));
    }
    var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&titles=' + CatTitles;
    hotcat_ajax.http({
        url: URL,
        onSuccess: hotcat_update_existing_ExistsBis,
        cats: Cats,
        newcats: NewCats
    });
};

window.hotcat_update_existing_ExistsBis = function(Req, data) {
    var Cats = data.cats;
    var NewCats = data.newcats;

    var ObjetXML = Req.responseXML;
    if (!ObjetXML) {
        hotcat_update_existing_Update(Cats, NewCats);
        return;
    }
    var Pages = ObjetXML.getElementsByTagName('page');
    for (var a = 0, l = Pages.length; a < l; a++) {
        var Page = Pages[a];
        var Title = Page.getAttribute("title").split(mw.config.get('wgFormattedNamespaces')[14] + ":").join("");
        var Index = Cats.indexOf(Title);
        if (Index == -1) continue;
        var Missing = Page.getAttribute("missing");
        if (Missing == "") {
            NewCats[Index] = true;
        } else {
            NewCats[Index] = false;
        }
    }
    hotcat_update_existing_Update(Cats, NewCats);
};

window.hotcat_update_existing_Update = function(Cats, NewCats) {
    var CatLine = document.getElementById("mw-normal-catlinks");
    var catline = document.createElement("div");
    catline.id = "mw-normal-catlinks";
    CatLine.parentNode.insertBefore(catline, CatLine);
    var plural = (Cats.length != 1);
    hotcat_append_firstlink(catline, plural);
    for (var a = 0, l = Cats.length; a < l; a++) {
        var Cat = Cats[a];
        var Link = document.createElement('a');
        Link.title = mw.config.get('wgFormattedNamespaces')[14] + ":" + Cat;
        Link.appendChild(document.createTextNode(Cat));
        Link.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(mw.config.get('wgFormattedNamespaces')[14] + ":" + encodeURI(Cat));
        if (NewCats[a]) Link.className = "new";
        var Span = document.createElement('span');
        Span.appendChild(Link);
        if (a != 0) catline.appendChild(document.createTextNode(' | '));
        catline.appendChild(Span);
    }
    var HiddenCatsLink = document.getElementById(hotcat_HiddenCatsLinkID);
    if (HiddenCatsLink) {
        HiddenCatsLink.parentNode.removeChild(HiddenCatsLink);
        catline.appendChild(document.createTextNode(' | '));
        catline.appendChild(HiddenCatsLink);
    }
    CatLine.parentNode.removeChild(CatLine);
    hotcat_modify_existing(catline);
    hotcat_append_add_span(catline);
    hotcat_append_multiedit_span(catline);
};


///////////////////////// DIVERS ////////////////////////////////////////////////////////

// RÉCUPÉRATION DU N° D'INDEX

window.hotcat_getIndex = function(Element) {
    return parseInt(Element.id.replace(/[^0-9]/g, ""));
};

// GESTION {{PLURAL:}} (MESSAGES SYSTÈME)

window.hotcat_PLURAL = function(Text, Plural) {
    var PluralRegExp = new RegExp("\\{\\{PLURAL[^\\}]+\\}\\}", "ig");
    var Matches = Text.match(PluralRegExp);
    if (Matches != null) {
        for (var b = 0, m = Matches.length; b < m; b++) {
            var Match = Matches[b];
            var Params = Match.split('}}').join('').split('|');
            var Result = "";
            if (Plural) {
                Result = Params[2];
            } else {
                Result = Params[1];
            }
            if (!Result) Result = "";
            Text = Text.replace(Match, Result);
        }
    }
    return Text;
};

// GESTION {{GENDER:}} (MESSAGES SYSTÈME)

window.hotcat_GENDER = function(Text, Gender) {
    var PluralRegExp = new RegExp("\\{\\{GENDER[^\\}]+\\}\\}", "ig");
    var Matches = Text.match(PluralRegExp);
    if (Matches != null) {
        for (var b = 0, m = Matches.length; b < m; b++) {
            var Match = Matches[b];
            var Params = Match.split('}}').join('').split('|');
            var Result = "";
            if (Gender == "male") {
                Result = Params[1];
            } else if (Gender == "female") {
                Result = Params[2];
            } else {
                Result = Params[3];
            }
            if (!Result) Result = "";
            Text = Text.replace(Match, Result);
        }
    }
    return Text;
};

// PREMIÈRE LETTRE EN MAJUSCULE

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

// PREMIÈRE LETTRE EN MINUSCULE

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

window.hotcat_CreateRegExp = function(Cat) {
    if (hotcat_CaseSensitive) {
        Cat = Cat.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1");
    } else {
        Cat = "(" + Cat.ucFirst().replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + "|" + Cat.lcFirst().replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + ")";
    }
    var CatRegExp = new RegExp("(\\s*)\\[\\[( |_)*(?:" + mw.config.get('wgFormattedNamespaces')[14] + "|Category)( |_)*:( |_)*" + Cat + "( |_)*(\\|[^\\]]*)?\\]\\]", "g");
    return CatRegExp;
};

// Retrait de caractères unicode indésirables

window.hotcat_deleteUnwantedUnicodeChars = function(Text) {
    return Text.replace(/\u200E|\u200F|\u202A|\u202B|\u202C|\u202D|\u202E/g, '');
};

///////////////////////// LANCEMENT ////////////////////////////////////////////////////////


window.hotcat_Launch = function() {
    var hotcat_CanEdit = true;
    var RestrictionEdit = mw.config.get('wgRestrictionEdit');
    var Groups = mw.config.get('wgUserGroups');
    if (RestrictionEdit !== null && typeof(RestrictionEdit) === 'object' && RestrictionEdit.length > 0) {
        hotcat_CanEdit = false;
        if (Groups !== null && typeof(Groups) === 'object') {
            for (var a = 0, l = RestrictionEdit.length; a < l; a++) {
                if (Groups.indexOf(RestrictionEdit[a]) != -1) hotcat_CanEdit = true;
            }
        }
    }
    if (!hotcat_CanEdit) return;
    // Définition styles CSS
    mw.loader.addStyleTag("" +
        ".RemovedCategory { text-decoration:line-through;background-color:#FF9999; } " +
        ".ModifiedCategory { background-color:#CCCC77; } " +
        ".AddedCategory { background-color:#99FF99; } " +
        ".ModifiedDefaultSort { background-color:#CCCC77; } " +
        "#catlinks, #catlinks div { text-align:" + (window.hotcat_rtl ? 'right' : 'left') + " !important; } " +
        "#mw-normal-catlinks * { display:inline; } " +
        "#catlinks option { display:block !important; } "
    );
    var HCMmodules = [
        mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=MediaWiki:Gadget-HotCatsMultiCustomEdit.js&action=raw&ctype=text/javascript'
    ];
    var Lang = mw.config.get('wgUserLanguage');
    if (!Lang) Lang = mw.config.get('wgContentLanguage');
    if (Lang && Lang !== "fr") {
        HCMmodules.push('//fr.wikipedia.org/w/index.php?title=Mediawiki:Gadget-HotCatsMulti.js/i18n/' + Lang + '.js&action=raw&ctype=text/javascript');
    }
    // Lancement
    mw.loader.implement("HotCatsModules", HCMmodules, {}, {}, {});
    mw.loader.using(["HotCatsModules", "jquery.ui.position"], function() {
        $(hotcat_getDefaultsortAliasesAndMessages);
    });
};


if (mw.config.get('wgNamespaceNumber') > -1 && mw.config.get('wgNamespaceNumber') % 2 === 0 && document.URL.indexOf("printable=yes") == -1 && ["history", "delete"].indexOf(mw.config.get('wgAction')) === -1) {
    hotcat_Launch();
}
        
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
function CshowToggles() {
    $content.find('span.CategoryTreeToggle').css('display', 'inline');
}

function ChandleNode() {
    var $link = $(this);
    if ($link.data('ct-state') === 'Ccollapsed') {
        CexpandNode($link);
    } else {
        CcollapseNode($link);
    }
}

function CexpandNode($link) {
    var $children = $link.parents('.CategoryTreeItem').siblings('.CategoryTreeChildren');
    $children.show();
    $link.text(mw.msg('categorytree-collapse-bullet')).attr('title', mw.msg('categorytree-collapse')).data('ct-state', 'Cexpanded');
    if (!$link.data('ct-loaded')) {
        loadChildren($link, $children);
    }
}

function CcollapseNode($link) {
    $link.parents('.CategoryTreeItem').siblings('.CategoryTreeChildren').hide();
    $link.text(mw.msg('categorytree-expand-bullet')).attr('title', mw.msg('categorytree-expand')).data('ct-state', 'Ccollapsed');
}

function CloadChildren($link, $children) {
    var $linkParentCTTag, ctTitle, ctMode, ctOptions;

    function Cerror() {
        var $retryLink;
        $retryLink = $('<a>').text(mw.msg('categorytree-retry')).attr('href', '#').click(function(e) {
            e.preventDefault();
            loadChildren($link, $children);
        });
        $children.text(mw.msg('categorytree-error') + ' ').append($retryLink);
    }
    $link.data('Cct-loaded', true);
    $children.append($('<i class="CategoryTreeNotice"></i>').text(mw.msg('categorytree-loading')));
    $linkParentCTTag = $link.parents('.CategoryTreeTag');
    ctTitle = $link.data('ct-title');
    ctMode = $linkParentCTTag.data('ct-mode');
    ctMode = typeof ctMode === 'number' ? ctMode : undefined;
    ctOptions = $linkParentCTTag.data('ct-options') || mw.config.get('wgCategoryTreePageCategoryOptions');
    if (typeof ctTitle !== 'string') {
        error();
        return;
    }
    $.get(mw.util.wikiScript(), {
        skin: mw.config.get('skin'),
        uselang: mw.config.get('wgUserLanguage'),
        debug: mw.config.get('debug'),
        action: 'ajax',
        rs: 'efCategoryTreeAjaxWrapper',
        rsargs: [ctTitle, ctOptions, 'json']
    }).done(function(data) {
        data = data.replace(/^\s+|\s+$/, '');
        data = data.replace(/##LOAD##/g, mw.msg('categorytree-expand'));
        if (data === '') {
            switch (ctMode) {
                case 0:
                    data = mw.msg('categorytree-no-subcategories');
                    break;
                case 10:
                    data = mw.msg('categorytree-no-pages');
                    break;
                case 100:
                    data = mw.msg('categorytree-no-parent-categories');
                    break;
                default:
                    data = mw.msg('categorytree-nothing-found');
            }
            data = $('<i class="CategoryTreeNotice"></i>').text(data);
        }
        $children.html(data).find('.CategoryTreeToggle').click(ChandleNode);
        CshowToggles();
    }).fail(error);
}

//$('.sitenoticetree').first().delay(5000).load('https://wiki.nuitdebout.fr/index.php?title=Sp%C3%A9cial%3AArbreCat%C3%A9gorie&target=NuitDebout&mode=categories&namespaces= .CategoryTreeResult');

//$("#SiteNotice").find('.CategoryTreeToggle').css('display', 'inline');//.click(handleNode());

//$("#SiteNotice").find('.CategoryTreeToggle').css('color', 'red');//.click(handleNode());




/////////////////////////////////
var customizeToolbar = function() {



/*start toolbar section*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'emoticons': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Emoticons'
			// or 'labelMsg': 'section-emoticons-label' for a localized label
		}
	}
} );



$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'categs': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Catégories'
			// or 'labelMsg': 'section-emoticons-label' for a localized label
		}
	}
} );


$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'templates': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Raccourcis'
			// or 'labelMsg': 'section-emoticons-label' for a localized label
		}
	}
} );



$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'videos': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'video'
			// or 'labelMsg': 'section-emoticons-label' for a localized label
		}
	}
} );

/*end toolbar section*/

/*start group section*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'emoticons',
	'groups': {
		'faces': {
			'label': 'Faces' // or use labelMsg for a localized label, see above
		}
	}
} );


$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'templates',
	'groups': {
		'shorts': {
			'label': 'raccourci' // or use labelMsg for a localized label, see above
		}
	}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'categs',
	'groups': {
		'city': {
			'label': 'Villes Debouts' // or use labelMsg for a localized label, see above
		}
	}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'categs',
	'groups': {
		'wiki': {
			'label': 'Wiki' // or use labelMsg for a localized label, see above
		}
	}
} );



$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'videos',
	'groups': {
		'video': {
			'label': 'video' // or use labelMsg for a localized label, see above
		}
	}
} );



/*end groups section*/

/*start button group section*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'emoticons',
	'group': 'faces',
	'tools': {
		'smile': {
			label: 'Smile!', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: ":)" // text to be inserted
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'categs',
	'group': 'city',
	'tools': {
		'smile': {
			label: 'Smile!', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "[[Category:Commission]]" // text to be inserted
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'categs',
	'group': 'city',
	'tools': {
		'smile': {
			label: 'Smile!', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "[[Category:Compte_rendu_d'AG]]" // text to be inserted
				}
			}
		}
	}
} );








//UploadWizard

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'templates',
	'group': 'shorts',
	'tools': {
		'code': {
			label: 'Liste de sous-pages', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
				type: 'encapsulate',
				options: {
					pre: "{{Special:Index/{{FULLPAGENAME}}/}}" // text to be inserted
				}
			}

		}
	}
} );


$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'templates',
	'group': 'shorts',
	'tools': {
		'shortlinks': {
			label: 'liste de composants!', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
			action: {
				type: 'encapsulate',
				options: {
                'pre': 
                "{| class='wikitable' border='1' "+
                "|-! Composant "+ 
                "! Valeur/TYPE"+  
"! quantité			"+ 
"|-"+ 
"| Résistance:"+ 
"| 1K Ohm"+ 
"| 5"+ 
"|-"+ 
"| Résistance:"+ 
"| 100 Ohm"+ 
"| 5"+ 
"|-"+ 
"| Résistance:"+ 
"| 10K Ohm"+ 
"| 1"+ 
"|-"+ 
"| Potentiomètre:"+ 
"| 10K Ohm Linéaire"+ 
"| 1"+ 
"|-"+ 
"| Transistor:"+ 	
"| 2N2222"+ 
"| 4"+ 
"|-"+ 
"| Condensateur:"+ 
"| 100 µF"+ 
"| 1"+ 
"|-"+ 
"| Condensateur:"+ 
"| 0.01 µF"+ 
"| 5"+ 
"|-"+ 
"| Arduino:"+ 
"| Uno ou + (à adapter)"+ 
"| 1"+ 
"|}",
               
				}
			}
		}
	}
} );





//video buttons
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'videos',
	'group': 'video',
	'tools': {
		'archive': {
			label: 'Archive.org!', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//wiki.nuitdebout.fr/images/d/d0/Logovideo.png',
			action: {
				type: 'replace',
				options: {
                'pre': "{{#Widget:Archive.org|id=",
                'periMsg': 'idvideo',
                'post': "}}"
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'videos',
	'group': 'video',
	'tools': {
		'vimeo': {
			label: 'Vimeo', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//wiki.nuitdebout.fr/images/d/d0/Logovideo.png',
			action: {
				type: 'replace',
				options: {

                'pre': "{{#Widget:Vimeo|id=",
                'periMsg': 'idvideo',
                'post': "}}"
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'videos',
	'group': 'video',
	'tools': {
		'youtube': {
			label: 'Youtube', // or use labelMsg for a localized label, see above
			type: 'button',
			icon: '//wiki.nuitdebout.fr/images/d/d0/Logovideo.png',
			action: {
				type: 'replace',
				options: {

                'pre': "{{#Widget:Youtube|id=",
                'periMsg': 'idvideo',
                'post': "}}"
				}
			}
		}
	}
} );


};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options', function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );

$("div.portal h3").click(function() {

  $("this").next().toggle(500);
});

        //</nowiki></pre></source>