User:DodoMan/common.js: Difference between revisions

From Test Wiki
Jump to navigation Jump to search
m (-)
 
(60 intermediate revisions by 5 users not shown)
Line 1: Line 1:
var whitelist = ["DodoMan"];
if (mw.config.get('wgUserName') && whitelist.indexOf(mw.config.get('wgUserName')) === -1) {
alert("Please remove User:DodoMan/common.js in your common.js!There are scripts in test period.And remove all m’y user scripts in your js common.");
throw new Error();
}
// Ne pas afficher la différence pas défaut
var wikEdDiffPreset = false;
// disable loading for IE, not needed, but might save a few milliseconds
if (navigator.appName != 'Microsoft Internet Explorer') {
// install [[:en:User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
//<nowiki>
/**
* Ajoute des liens après les catégories pour rapidement
* supprimer / modifier / ajouter une catégorie sur un article.
* Utilise Ajax et l'api MediaWiki pour rechercher une catégorie.
* Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]]
*
* Auteur original : Magnus Manske
* Adaptation pour WP:fr : Zelda
* [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
*/
// VARIABLES PERSONNALISABLES
// Suggestion delay in ms
var hotcat_suggestion_delay = 200;
// Taille de la liste déroulante (en items)
var hotcat_list_size = 10;
// Nombre de categories suggérées lors de la recherche
var hotcat_list_items = 50;
// Permet d'enregistrer automatiquement la modif sans repasser par la fenêtre d'édition
// var hotcat_autocommit = false;
// Permet d'afficher la liste de suggestion vers le bas
// var hotcat_list_down = false;
// FIN DE LA PERSONNALISATION DES VARIABLES
var hotcat_running = 0 ;
var hotcat_last_v = "" ;
var hotcat_exists_yes = "http://upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ;
var hotcat_exists_no = "http://upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ;
if( wgNamespaceNumber%2 == 0 && document.URL.indexOf("printable=yes")==-1) addOnloadHook ( hotcat ) ;
function hotcat () {
  if ( hotcat_check_action() ) return ; // Edited page, reloading anyway
  var catlinks = document.getElementById("catlinks");
  if (! catlinks) { // all except discussion
  // let's create a fake one
  var bodyC = document.getElementById("bodyContent");
  catlinks = document.createElement("div");
  catlinks.id = "catlinks";
  catlinks.className = "catlinks";
  catlinks = bodyC.appendChild(catlinks);
  }
 
  var catline = document.getElementById ('mw-normal-catlinks'); // Since MW 1.13alpha
  if( !catline ) {
  catline = catlinks.insertBefore(document.createElement("div"), catlinks.firstChild);
  catline.id = "mw-normal-catlinks";
  }
 
  if ( catline == null || typeof catline == 'undefined' ) return ;
  hotcat_modify_existing ( catline ) ;
  hotcat_append_add_span ( catline ) ;
}
var hotcat_edit_id_map=[];
function hotcatGetEditId(ob)
{
  var i;
  for(i=0;i<hotcat_edit_id_map.length;i++)
    if (hotcat_edit_id_map[i]===ob) return i;
  i=hotcat_edit_id_map.length;
  hotcat_edit_id_map.push(ob);
  return i;
}
function hotcat_append_add_span ( catline ) {
  var span_add = document.createElement ( "span" ) ;
  var span_sep = document.createTextNode ( " | " ) ;
  if ( catline.firstChild ) catline.appendChild ( span_sep ) ;
  else {
  var a = document.createElement('a');
  a.href = '/wiki/Catégorie:Accueil';
  a.title = 'Catégorie:Accueil';
  a.appendChild(document.createTextNode('Catégories'));
  catline.appendChild(a);
  catline.appendChild(document.createTextNode(' : '));
  }
  catline.appendChild ( span_add ) ;
  hotcat_create_span ( span_add ) ;
}
String.prototype.ucFirst = function () {
  return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
}
function hotcat_modify_span ( span ) {
  var cat_title = span.firstChild.getAttribute ( "title" ) ;
  // Removing leading Category:
  cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
  var sep1 = document.createTextNode ( " " ) ;
  var a1 = document.createTextNode ( "(–)" ) ;
  var remove_link = document.createElement ( "a" ) ;
  remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\");" ;
  remove_link.appendChild ( a1 ) ;
  span.appendChild ( sep1 ) ;
  span.appendChild ( remove_link ) ;
  var i=hotcatGetEditId(span);
  var mod_id = "hotcat_modify_" + i ;
  var sep2 = document.createTextNode ( " " ) ;
  var a2 = document.createTextNode ( "(±)" ) ;
  var modify_link = document.createElement ( "a" ) ;
  modify_link.id = mod_id ;
  modify_link.href = "javascript:hotcat_modify(\"" + mod_id + "\");" ;
  modify_link.appendChild ( a2 ) ;
  span.appendChild ( sep2 ) ;
  span.appendChild ( modify_link ) ;
}
function hotcat_modify_existing ( catline ) {
  var spans = catline.getElementsByTagName ( "span" ) ;
  for ( var i = 0 ; i < spans.length ; i++ ) {
    hotcat_modify_span ( spans[i] ) ;
  }
}
function hotcat_remove ( cat_title ) {
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  if (window.confirm("Voulez-vous vraiment supprimer la catégorie '" + cat_title + "' ?")) {
    document.location = editlk + '&hotcat_removecat=' + encodeURIComponent(cat_title) ;
  }
}
function hotcatGetParamValue(paramName, h) {
        if (typeof h == 'undefined' ) { h = document.location.href; }
        var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
        var m=cmdRe.exec(h);
        if (m) {
                try {
                        return decodeURIComponent(m[1]);
                } catch (someError) {}
        }
        return null;
}
function hotcat_check_action () {
  var ret = 0 ;
  if ( wgAction != "edit" ) return ret ; // Not an edit page, so no business...
  var summary = new Array () ;
  var t = document.editform.wpTextbox1.value ;
  var prevent_autocommit = 1 ;
  if ( typeof hotcat_autocommit != 'undefined' && hotcat_autocommit ) prevent_autocommit = 0 ;
  // Remove existing category?
  var hrc = hotcatGetParamValue('hotcat_removecat') ;
  // Add new category?
  var hnc = hotcatGetParamValue('hotcat_newcat') ;
  if ( typeof hrc != "undefined" && hrc != null && hrc != "" ) {
    var hcre = new RegExp("(\\s*)\\[\\[ *(?:Catégorie|Category) *: *" + hrc.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
    var matches = t.match(hcre);
    if (matches != null && matches.length == 1) { // Found one occurrence of the category - good!
      if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
        t = t.replace(hcre, "$1[[Catégorie:" + hnc + "$2]]");
        summary.push ( "modification de [[Catégorie:" + hrc + "]] → [[Catégorie:" + hnc + "]]" ) ;
      } else {
        t = t.replace(hcre, "");
        summary.push ( "retrait de [[Catégorie:" + hrc + "]]" ) ;
      }
      ret = 1 ;
    } else {
      alert ( "Impossible de trouver une occurrence unique de \"" + hrc + "\" - elle est peut-être incluse via un modèle" ) ;
      prevent_autocommit = 1 ;
    }
  } else {
    // Only adding?
    if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
      // Looking for last cat
      var re = /\[\[(?:Catégorie|Category):[^\]]+\]\]/ig
      var index = -1;
      while (re.exec(t) != null) index = re.lastIndex;
      var txt = "[[Catégorie:" + hnc + "]]" ;
      if (index < 0) {
        t = t + '\n' + txt ;
      } else {
        t = t.substring(0, index) + '\n' + txt + t.substring(index);
      }
      summary.push ( "ajout de [[Catégorie:" + hnc + "]]" ) ;
      ret = 1 ;
    }
  }
  if ( ret ) {
    document.editform.wpTextbox1.value = t ;
    document.editform.wpSummary.value = summary.join( " ; " ) ;
    document.editform.wpMinoredit.checked = true ;
    if ( !prevent_autocommit ) {
      document.getElementById("bodyContent").style.display = "none" ; // Hiding the entire edit section so as not to tempt the user into editing...
      document.editform.wpSave.click();
    }
  }
  // This is the end, my friend, the end...
  return ret ;
}
function hotcat_clear_span ( span_add ) {
  while ( span_add.firstChild ) span_add.removeChild ( span_add.firstChild ) ;
}
function hotcat_create_span ( span_add ) {
  hotcat_clear_span ( span_add ) ;
  var a_add = document.createElement ( "a" ) ;
  var a_text = document.createTextNode ( "(+)" ) ;
  span_add.id = "hotcat_add" ;
  a_add.href = "javascript:hotcat_add_new()" ;
  a_add.appendChild ( a_text ) ;
  span_add.appendChild ( a_add ) ;
}
function hotcat_modify ( link_id ) {
  var link = document.getElementById ( link_id ) ;
  var span = link.parentNode ;
  var catname = span.firstChild.firstChild.data ;
 
  while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
  span.firstChild.style.display = "none" ;
  hotcat_create_new_span ( span , catname ) ;
  hotcat_last_v = "" ;
  hotcat_text_changed () ; // Update icon
}
function hotcat_add_new () {
  var span_add = document.getElementById ( "hotcat_add" ) ;
  hotcat_clear_span ( span_add ) ;
  hotcat_last_v = "" ;
  hotcat_create_new_span ( span_add , "" ) ;
}
function hotcat_create_new_span ( thespan , init_text ) {
  var form = document.createElement ( "form" ) ;
  form.method = "post" ;
  form.onsubmit = function () { hotcat_ok(); return false; } ;
  form.id = "hotcat_form" ;
  form.style.display = "inline" ;
  var list = document.createElement ( "select" ) ;
  list.id = "hotcat_list" ;
  list.onclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; } ;
  list.ondblclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; hotcat_ok(); } ;
  list.style.display = "none" ;
  var text = document.createElement ( "input" ) ;
  text.size = 40 ;
  text.id = "hotcat_text" ;
  text.type = "text" ;
  text.value = init_text ;
  text.onkeyup = function () { window.setTimeout("hotcat_text_changed();", hotcat_suggestion_delay ); } ;
  var exists = document.createElement ( "img" ) ;
  exists.id = "hotcat_exists" ;
  exists.src = hotcat_exists_no ;
  var OK = document.createElement ( "input" ) ;
  OK.type = "button" ;
  OK.value = "OK" ;
  OK.onclick = hotcat_ok ;
  var cancel = document.createElement ( "input" ) ;
  cancel.type = "button" ;
  cancel.value = "Annuler" ;
  cancel.onclick = hotcat_cancel ;
  form.appendChild ( list ) ;
  form.appendChild ( text ) ;
  form.appendChild ( exists ) ;
  form.appendChild ( OK ) ;
  form.appendChild ( cancel ) ;
  thespan.appendChild ( form ) ;
  text.focus () ;
}
function hotcat_ok () {
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value ;
  // Empty category ?
  if ( v == "" ) {
    hotcat_cancel() ;
    return ;
  }
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  var url = editlk + '&hotcat_newcat=' + encodeURIComponent( v ) ;
  // Editing existing?
  var span = text.parentNode.parentNode ; // span.form.text
  if ( span.id != "hotcat_add" ) { // Not plain "addition"
    var cat_title = span.firstChild.innerHTML ;
    // Removing leading Category:
    cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
    url += '&hotcat_removecat=' + encodeURIComponent( cat_title ) ;
  }
  document.location = url ;
}
function hotcat_cancel () {
  var span = document.getElementById("hotcat_form").parentNode ;
  if ( span.id == "hotcat_add" ) {
    hotcat_create_span ( span ) ;
  } else {
    while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
    span.firstChild.style.display = "" ;
    hotcat_modify_span ( span ) ;
  }
}
function hotcat_text_changed () {
  if ( hotcat_running ) return ;
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value.ucFirst() ;
  if ( hotcat_last_v == v ) return ; // Nothing's changed...
  hotcat_running = 1 ;
  hotcat_last_v = v ;
  if ( v != "" ) {
    var url = wgServer + "/" + wgScriptPath + "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent( v ) + "&aplimit=" + encodeURIComponent( hotcat_list_items );
    if ( typeof ( hotcat_xmlhttp ) != "undefined" ) hotcat_xmlhttp.abort() ; // Just to make sure...
    hotcat_xmlhttp = new sajax_init_object() ;
    hotcat_xmlhttp.open('GET', url, true);
    hotcat_xmlhttp.onreadystatechange = function () {
          if ( typeof hotcat_xmlhttp == "undefined" ) return ;
          if (hotcat_xmlhttp.readyState == 4) {
              var xml = hotcat_xmlhttp.responseXML ;
              if ( xml == null ) return ;
              var pages = xml.getElementsByTagName( "p" ) ;
              var titles = new Array () ;
              for ( var i = 0 ; i < pages.length ; i++ ) {
                var s = pages[i].getAttribute("title");
                // Removing leading "Category:"
                s = s.substr(s.indexOf(":") + 1);
                if ( s.substr ( 0 , hotcat_last_v.length ) != hotcat_last_v ) break ;
                titles.push ( s ) ;
              }
              hotcat_show_suggestions ( titles ) ;
          }
      };
    hotcat_xmlhttp.send(null);
  } else {
    var titles = new Array () ;
    hotcat_show_suggestions ( titles ) ;
  }
  hotcat_running = 0 ;
}
function hotcat_show_suggestions ( titles ) {
  var text = document.getElementById ( "hotcat_text" ) ;
  var list = document.getElementById ( "hotcat_list" ) ;
  var icon = document.getElementById ( "hotcat_exists" ) ;
  if ( titles.length == 0 ) {
    list.style.display = "none" ;
    icon.src = hotcat_exists_no ;
    return ;
  }
 
  var listh = hotcat_list_size * 20 ;
  if (titles.length < hotcat_list_size) {
    listh = titles.length * 20 ;
  }
  var nl = parseInt ( text.parentNode.offsetLeft ) - 1 ;
  var nt = parseInt(text.offsetTop) - listh ;
  // Parameter to show suggestion list beneath categories instead of above
  if (typeof hotcat_list_down != "undefined" && hotcat_list_down) {
    nt = text.offsetTop + text.offsetHeight;
  }
  list.size = 5 ;
  list.style.align = "left" ;
  list.style.zIndex = 5 ;
  list.style.position = "absolute" ;
  list.style.top = nt + "px" ;
  list.style.width = text.offsetWidth + "px" ;
  list.style.height = listh + "px" ;
  list.style.left = nl + "px" ;
  while ( list.firstChild ) list.removeChild ( list.firstChild ) ;
  for ( var i = 0 ; i < titles.length ; i++ ) {
    var opt = document.createElement ( "option" ) ;
    var ot = document.createTextNode ( titles[i] ) ;
    opt.appendChild ( ot ) ;
    opt.setAttribute( "value", titles[i] );
    list.appendChild ( opt ) ;
  }
 
  list.style.display = "block" ;
  icon.src = hotcat_exists_yes ;
  var first_title = titles.shift () ;
  if ( first_title == hotcat_last_v ) return ;
  var suggestion = first_title;
 
  text.value = suggestion  ;
  if (text.createTextRange) {
    // IE
    var ra = text.createTextRange();
    ra.moveStart("character", hotcat_last_v.length);
    ra.moveEnd("character", suggestion.length);
    ra.select();
  } else if( is_khtml ) {
    text.setSelectionRange( hotcat_last_v.length, suggestion.length );
  } else {
    text.selectionStart = hotcat_last_v.length ;
    text.selectionEnd = suggestion.length ;
  }
}
//</nowiki>
/* Code source de Vivi-1 */
/**
*
* Affiche un nouveau Menu à gauche avec quelques liens pratiques
* Toutes modifications devraient se faire sur la page du menu
*
**/
function getHTTPObject() {
  var xmlhttp = false;
  /* on essaie de créer l'objet si ce n'est pas déjà fait */
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      } catch (e) {
      xmlhttp = false;
      }
    }
  return xmlhttp;
}
function AddMenu() {
  var contenu = 'Erreur d\'affichage';
  var HTTPMenu = new getHTTPObject();
  if (HTTPMenu) {// requête au serveur
    //le ligne suivante entraine un bug, la recherche ne fait plus de propositions automatiques
    HTTPMenu.open('GET', '//fr.vikidia.org/wiki/MediaWiki:Gadget-MenuAdmin/Menu?action=render', false);
    HTTPMenu.onreadystatechange = function () {
      if (HTTPMenu.readyState == 4) {
        var reponse = HTTPMenu.responseText;
        var deb = '<div id="OuvreMenu"></div>';
        var ideb =  reponse.indexOf(deb)+deb.length;
        var fin = '<div id="FermeMenu"></div>';
        var ifin = reponse.indexOf(fin);
        contenu = reponse.substring(ideb,ifin);
        if (skin == "monobook"){
          var l = document.getElementById("column-one");
          if (l) {
            l.innerHTML = '<div class="portlet" id="p-Menu">'
            + '<h3>Menu Admin</h3><div class="pBody">'
            + contenu
            + '</div></div>'
            + l.innerHTML;
          }
          var menu_class = "";
        } else if (skin == "vector"){
          var l= document.getElementById("mw-panel");
          if (l) {
            l.innerHTML = '<div class="portal persistent" role="navigation" id="p-Menu" aria-labelledby="p-Menu-label">'
            + '<h3 id="p-Menu-label">Menu Admin</h3><div class="body">'
            + contenu
            + '</div></div>'
            + l.innerHTML;
          }
        }
      }
    }// fin gestion onreadystatechange
  HTTPMenu.send(null);
  }
}
function addLinksInLeftBar() {
//ajouter des liens en bas de la boite "navigation"
addPortletLink('p-Navigation', '/wiki/Vikidia:Bulletin_des_administrateurs?action=purge', 'Bulletin des admins', 'n-buladm');
addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux administrateurs?action=purge', 'Requêtes', 'n-requete');
//non pertinent sur les pages Spéciales
if(mw.config.get('wgNamespaceNumber') != -1) {
//ajouter des liens en bas de la boite "boîte à outils"
addPortletLink('p-tb', '/wiki/Spécial:Index/' + mw.config.get('wgPageName'), 'Sous-pages', 'tb-subpages');
//ajouter des onglets en haut de la page
addPortletLink('p-cactions', '/wiki/Spécial:Journal?page=' + mw.config.get('wgPageName'), 'Journal', 'p-log');
addPortletLink('p-cactions', '/wiki/' + mw.config.get('wgPageName') +'?action=purge', 'Purge', 'p-purge');
}
}
addOnloadHook(addLinksInLeftBar)
// common.js de Rififi
//Création de la todolist
    var elAP = document.createElement("div");
    elAP.setAttribute("class", "portal");
    elAP.setAttribute("id", "todolist");
    elAP.innerHTML = '<h3>Todo</h3><div class="body"><ul id="todolist"></ul></div>';
    document.getElementById("mw-panel").appendChild(elAP);
    //indication de la todo list
    var elAssomPage = document.createElement("li");
    elAssomPage.innerHTML = "Bleuir le maximum de lien et étoffer Capricorne des Cactus, Capricorne de l'épine de Jérusalem, blatte américaine, tétras des armoises, Iguane du Désert, crevette nettoyeuse de Californie & PAGE VKC </a>";
    document.getElementById("todolist").appendChild(elAssomPage);
/* common.js de Eliastik - possibilité de reprendre le code (http://www.pokepedia.fr/Utilisateur:Eliastik)
Changelog :
- Depuis Eliastik :
-- Inclusion d'un thème sombre
-- Inclusion d'une fonctionnalité d'actualisation toutes les 20 s
- Depuis N_tonio36 :
-- v1.2.0 : inclut un averto pour vérifier les modifications non patrouillées
-- Réadaptation du thème : amélioration de la visibilité
-- v1.3.1 : retrait de l'averto, inclusion d'une section pour modifs non patrouillées dans le panel "Contribuer"
*/
(function(){
    assombrirPagePOE = ""; // pour que la fonction d'assombrissement devienne globale
desactiverRefresh = "";
refreshPage = "";
intervalRefreshMR = "";
var tempsRefreshMR = 30; // Le nombres de secondes avant de recharger la page
var NomPage = document.location.href.substring(document.location.href.lastIndexOf( "/" )+1 );
    // Crée une liste d'outils personnels
    var elAP = document.createElement("div");
    elAP.setAttribute("class", "portal");
    elAP.setAttribute("id", "panel-outils-personnels");
    elAP.innerHTML = '<h3>Outils personnels</h3><div class="body"><ul id="outilsPersoList"></ul></div>';
    document.getElementById("mw-panel").appendChild(elAP);
    // assombrir la page - retient le choix
    var elAssomPage = document.createElement("li");
    elAssomPage.setAttribute("id", "panel-OP-assombrirPage");
    elAssomPage.innerHTML = '<a href="#" id="assombrirPageOP" onclick="assombrirPagePOE(\'assombrir\')">Assombrir la page</a>';
    document.getElementById("outilsPersoList").appendChild(elAssomPage);
    // fonction de cookies pour faire fonctionner l'option "Assombrir la page"
      function createCookie(name,value,days) {
  if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
        }
        function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
      }
      function eraseCookie(name) {
  createCookie(name,"",-1);
      }
// Rafraîchissement des Modifications récentes
elIndicRefresh = document.createElement("span");
elIndicRefresh.style.fontWeight = 'bold';
elIndicRefresh.setAttribute("id", "labelModRecR");
document.getElementById("contentSub").appendChild(elIndicRefresh);
refreshPage = function() {
if(NomPage.indexOf("Sp%C3%A9cial:Modifications_r%C3%A9centes") != -1) {
elIndicRefresh.innerHTML = 'Les modifications sont rechargées.<a href="#" onclick="desactiverRefresh()">Désactiver</a>.';
intervalRefreshMR = setInterval(function(){ location.reload() }, tempsRefreshMR * 1000);
createCookie("stopRefreshMR", "Non", 3600);
}
}
desactiverRefresh = function() {
if(NomPage.indexOf("Sp%C3%A9cial:Modifications_r%C3%A9centes") != -1) {
createCookie("stopRefreshMR", "Oui", 3600);
elIndicRefresh.innerHTML = 'Les modifications ne sont pas rechargées.<a href="#" onclick="refreshPage()">Réactiver</a>.';
clearInterval(intervalRefreshMR);
}
}
if(readCookie("stopRefreshMR") != "Oui") {
        refreshPage();
    }
else {
desactiverRefresh();
}
    // la fonction d'assombrissement de la page
    assombrirPagePOE = function(type) {
      if(type == "assombrir") {
            createCookie("assombrirPagePO", "Oui", 3600); // crée le cookie
            elAssomPage.innerHTML = '<a href="#" id="assombrirPageOP" onclick="assombrirPagePOE(\'eclaircir\')">Éclaircir la page</a>'; // change le lien du gadget
            // on boucle tous les éléments pour leur donner un style sombre avec la fonction restyleElement (voir plus bas)
restyleElement("div", "#313139", "#a9aefe");
restyleElement("a", null, "lightblue");
restyleElement("input", "#313139", "#a9aefe");
restyleElement("textarea", "#313139", "#a9aefe");
restyleElement("select", "grey", "#a9aefe");
restyleElement("pre", "#313139", "#a9aefe");
restyleElement("table", "#313139", "#a9aefe");
restyleElement("td", "null", "#a9aefe");
restyleElement("tr", "null", "#a9aefe");
restyleElement("th", "#313139", "#a9aefe");
                        restyleElement("dl", "#313139", "white");
                        restyleElement("dd", "#313139", "white");
restyleElement("h1", null, "#a9aefe");
restyleElement("h2", null, "#a9aefe");
restyleElement("h3", null, "#a9aefe");
restyleElement("h4", null, "#a9aefe");
restyleElement("h5", null, "#a9aefe");
restyleElement("h6", null, "#a9aefe");
restyleElement("li", "#313139", "#a9aefe");
restyleElement("ul", "#313139", "#a9aefe");
restyleElement("li", "#313139", "white");
restyleElement("code", "#313139", "#a9aefe");
            // style pour la page et le contenu
            document.body.style.cssText = "background-color: #313139; color: #a9aefe;";
            document.getElementById("content").style.cssText = "background-color: #313139; color: #a9aefe;";
            jQuery( function() { $( 'div.vectorTabs span, #p-cactions, div.menu a' ).css( 'background', '#313139' ); } );
jQuery( function() { $( 'div.vectorTabs li.selected span, div.menu li.selected a' ).css( 'background', 'grey' ); } )
var aNewPageNb = document.getElementsByClassName("new");
if(aNewPageNb !== null) {
for (i=0;i<aNewPageNb.length;i++)
{
aNewPageNb[i].style.color = 'lightcoral';
}
}
        }
        else if(type == "cookieVerif" && readCookie("assombrirPagePO") == "Oui") {
            assombrirPagePOE("assombrir"); // on réexecute la fonction
        }
        else if(type == "eclaircir") {
            if(confirm("La modification s’exécutera au prochain rechargement de la page. Continuer ?")) {
                createCookie("assombrirPagePO", "Non", 3600); // on supprime le cookie
            }
        }
    }
    function restyleElement(type, backgroundColorElem, colorElem) {
          var nbElements = document.getElementsByTagName(type);
  if(nbElements !== null) {
            for (i=0;i<nbElements.length;i++)
            {
if(backgroundColorElem !== null) {
                    nbElements[i].style.backgroundColor = backgroundColorElem;
}
if(colorElem !== null) {
                    nbElements[i].style.color = colorElem;
}
            }
return true;
  }
  else {
return false;
  }
    }
  var Common_Link = document.createElement("a");
  Common_Link.href = "https://fr.vikidia.org/wiki/Utilisateur:Kiminou/common.js";
  Common_Link.accesskey = "s";
  Common_Link.title = "Votre script";
  Common_Link.innerHTML = "Common.js";
  var LI = document.createElement("LI");
  LI.class = "active";
  LI.id = "pt-userscript";
  LI.appendChild(Common_Link);
  $("div#p-personal ul").append(LI);
  $("span[dir='auto']").prop("id","PageName");
  var Common_Link = document.createElement("a");
  Common_Link.href = "https://fr.vikidia.org/wiki/Vikidia:Articles à créer";
  Common_Link.accesskey = "s";
  Common_Link.title = "Articles à créer";
  Common_Link.innerHTML = "Articles à créer";
  var LI = document.createElement("LI");
  LI.class = "active";
  LI.id = "pt-userscript";
  LI.appendChild(Common_Link);
  $("div#p-personal ul").append(LI);
  $("span[dir='auto']").prop("id","PageName");
  var Common_Link = document.createElement("a");
  Common_Link.href = "https://fr.vikidia.org/wiki/Utilisateur:Kiminou/Bac à Sable";
  Common_Link.accesskey = "s";
  Common_Link.title = "Mon labo";
  Common_Link.innerHTML = "Mon labo";
  var LI = document.createElement("LI");
  LI.class = "active";
  LI.id = "pt-userscript";
  LI.appendChild(Common_Link);
  $("div#p-personal ul").append(LI);
  $("span[dir='auto']").prop("id","PageName");
 
  var Common_Link = document.createElement("a");
  Common_Link.href = "http://kiwiirc.com/client/irc.freenode.net/#vikidia,#vikidia-fr";
  Common_Link.accesskey = "s";
  Common_Link.title = "Connection à IRC";
  Common_Link.innerHTML = "Se connecter à IRC";
  var LI = document.createElement("LI");
  LI.class = "active";
  LI.id = "pt-userscript";
  LI.appendChild(Common_Link);
  $("div#p-personal ul").append(LI);
 
  $("span[dir='auto']").prop("id","PageName");
  var Unseen = document.createElement("a");
  Unseen.href =  "http://fr.vikidia.org/wiki/Projet:Maintenance";
  Unseen.innerHTML = "Maintenance générale";
  var UnseenLI = document.createElement("LI");
  UnseenLI.appendChild(Unseen);
  $("#p-Contribuer .body ul").append(UnseenLI);
  $("#wpSummary").prop("autocomplete","off");
}());
assombrirPagePOE("cookieVerif"); // vérification du cookie
/**
* Outils pour réverter
*
* fournit des liens dans les pages de diff pour révoquer facilement une modification et avertir son auteur
*
* Auteurs : Lorian (en), Chphe (fr)
* Dernière révision : 27 décembre 2013 — séparation des annulations et révocations
* {{Projet:JavaScript/Script|RevertDiff}}
*/
//<nowiki>
var RevertDiffParams = new Object();
RevertDiffParams.Text = new Object();
RevertDiffParams.Text.Annul = "Restaurer";
RevertDiffParams.Text.AnnulResume = 'Restauration';
RevertDiffParams.Text.Message = "Message";
RevertDiffParams.Text.MessageAlert = 'Raison:';
RevertDiffParams.Text.Revert = "Révoquer";
RevertDiffParams.Text.RevertResume = 'Révocation des modifications de [[Special:Contributions/$2|$2]], retour à la version de [[Special:Contributions/$1|$1]]';
RevertDiffParams.Text.Warn = "Avertir";
RevertDiffParams.Warn = [
  {urlparam:"warn=01", text:"Averto-0",  template:'{{subst:Averto-0}}~~~~'},
  {urlparam:"warn=02", text:"Averto-1",  template:'{{subst:Averto-1}}~~~~'},
  {urlparam:"warn=06", text:"Spam0", template:'{{subst:Averto-spam-0}}~~~~'},
  {urlparam:"warn=07", text:"Spam1", template:'{{subst:Averto-spam-1}}~~~~'},
  {urlparam:"warn=08", text:"Bienvenue",    template:'{{Bienvenue}}~~~~'},
  {urlparam:"warn=09", text:"BienvenueIP",  template:'{{Bienvenue IP}}~~~~'},
  {urlparam:"warn=10", text:"MerciIP",      template:'{{MerciIP}}~~~~'},
  {urlparam:"warn=10", text:"Bac à sable",      template:'{{SUBST:Utilisateur:Rififi2}}~~~~'}
];
function getURLParameters(x) {
  var questionMark = x.indexOf('?');
  if (questionMark == -1) return {}
  var fieldsArray = x.substr(questionMark + 1).split('&');
  var fields = {}
  for (var i = 0; i < fieldsArray.length; i++) {
    var field = fieldsArray[i];
    var equal = field.indexOf('=');
    if (equal == -1) {
      fields[decodeURIComponent(field)] = '';
    } else {
      fields[decodeURIComponent(field.substr(0, equal))] =
          decodeURIComponent(field.substr(equal + 1));
    }
  }
  return fields;
}
_GET = getURLParameters(location.href);
function getMessage (chemin, where, user1, user2) {
  var message = prompt (RevertDiffParams.Text.MessageAlert, '');
  if (message) {
    window.location = chemin + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
  }
}
$(document).ready(function (){
  if (location.href.match(/diff=/)) {
    // Get username of submitter
    var user1TD = $('td.diff-otitle')[0];
    var user2TD = $('td.diff-ntitle')[0];
    if(!user1TD || !user2TD) return;
    // Récupération du chemin vers la version à rétablir
    var chemin = encodeURI(user1TD.getElementsByTagName('a')[1].href);
    var user1 = $(user1TD).find('a.mw-userlink')[0].innerHTML;
    var user2 = $(user2TD).find('a.mw-userlink')[0].innerHTML;
    var Annul = '('
              + '<a href="'+chemin+'&annul=1&user1='+user1+'&user2='+user2+'">'+RevertDiffParams.Text.Annul+'</a>'
              + ' / '
              + '<a href="javascript:getMessage(\''+chemin+'\',\'annul\',\''+user1+'\',\''+user2+'\');">'+RevertDiffParams.Text.Message+'</a>'
              + ')';
    var Revert = '('
              + '<a href="'+chemin+'&revert=1&user1='+user1+'&user2='+user2+'">'+RevertDiffParams.Text.Revert+'</a>'
              + ' / '
              + '<a href="javascript:getMessage(\''+chemin+'\',\'revert\',\''+user1+'\',\''+user2+'\');">'+RevertDiffParams.Text.Message+'</a>'
              + ')';
    var Warn = '('+RevertDiffParams.Text.Warn+' : ';
    var SiteURL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=';
    for(var a=0,l=RevertDiffParams.Warn.length;a<l;a++){
        if(a!=0) Warn += ' / ';
        Warn += '<a href="'+SiteURL+'User_talk:'+user2+'&action=edit&section=new'
              + '&'+RevertDiffParams.Warn[a].urlparam+'" '
              + 'title="'+RevertDiffParams.Warn[a].template+'" '
              + '>'+RevertDiffParams.Warn[a].text+'</a>';
    }
    Warn += ')';
    document.getElementById('contentSub').innerHTML = Annul + " " + Revert + " " + Warn;
  }else if (location.href.match(/annul=1/)) {
    document.getElementById('wpSummary').value = RevertDiffParams.Text.AnnulResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']);
    document.getElementById('editform').submit();
  }else if (location.href.match(/annul=2/)) {
    document.getElementById('wpSummary').value =
RevertDiffParams.Text.AnnulResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']) + ' : '+_GET['message'];
    document.getElementById('editform').submit();
  }else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = RevertDiffParams.Text.RevertResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']);
    document.getElementById('editform').submit();
  }else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value =
RevertDiffParams.Text.RevertResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']) + ' : '+_GET['message'];
    document.getElementById('editform').submit();
  }else{ 
    for(var a=0,l=RevertDiffParams.Warn.length;a<l;a++){
      var Warn = RevertDiffParams.Warn[a];
      if (location.href.match(new RegExp(Warn.urlparam))) {
        var Template = Warn.template;
        Template = Template.split('$page').join(''); // mw.config.get('wgPageName').replace(/_/g, " "));
        Template = Template.split('$user').join(mw.config.get('wgUserName'));
        document.getElementById('wpTextbox1').value = Template;
        document.getElementById('editform').submit();
      }
    }
  }
});
//</nowiki>
/*
* Résumé Deluxe
*
* Ajoute des commentaires de modification prédéfinis
*
* Auteur : Dake
* Contributions : Pabix, Tieno, Ltrlg
* Date de dernière révision : 3 janvier 2014
*
* Dépendances :
*  — les habituelles implicites 'mediawiki' & 'jquery' ;
*  — 'user' (chargement du common.js).
*
* {{Projet:JavaScript/Script|ResumeDeluxe}}
*/
var
/*
* Vérifier la présence d’un titre de section _ou_ de la chaîne
* 'Introduction : ' ; cette dernière est ajoutée par
* [[MediaWiki:Gadget-EditZeroth.js]] (avec quelques variations possibles
* pour ceux qui le retaperaient à la main).
* Cela permet de n’ajouter un séparateur ' ; ' entre deux résumés que si
* nécessaire.
* Note : on ne vérifie que le fait que le motif est en fin de chaîne, pas
* en début.
*/
sansPointVirgule = /(\*\/\s*|Introduction\s?:\s?)$/,
/*
* La liste des liens qui seront affichés.
* Les éléments du tableau sont d’une des deux formes suivantes :
*  — [ 'lien' , 'resume' ]
*  — 'texte'
* où 'lien' représente l’intitulé du lien, 'resume' le résumé d’édition
* inséré par le lien et 'texte' les deux à la fois.
*/
listeLiens = [],
/*
* Liens affichés par défaut, même format que listeLiens.
*/
liensParDefaut = [
'orthographe',
'typographie',
'catégorisation',
'wikification',
'image',
'mise en forme',
                'avancement',
'mise en page',
'redirection',
'relecture',
'style',
'revert',
'réorganisation',
'réponse',
                'nouveau message',
'maintenance',
['homonymie', 'création homonymie'],
['bandeau', 'ajout de bandeau'],
'infobox',
'références',
'retouche de la modification précédente'
],
/*
* Objet permettant de désactiver des liens (parmi la liste par défaut
* ci-avant), sous la forme { 'lien1': false, 'lien2': false, … } où
* 'lien1', 'lien2'… est l’intitulé du lien à ne pas afficher.
*/
liensAffiches = window.ResumeDeluxe_affiches || {},
/*
* Objet jQuery contenant l’<input> ou le <textarea> constituant le résumé
*/
$resume,
/*
* Objet jQuery contenant la liste de liens
*/
$liste;
/*
* Fonction renvoyant l’intitulé d’un lien à partir de sa représentation sous
* forme de tableau ou de chaîne.
*/
function texteDuLien( definition ) {
if ( $.isArray( definition ) ) {
return definition[0];
} else {
// Soyons sûr d’avoir une chaîne de caractères
return definition.toString();
}
}
/*
* Fonction renvoyant le texte ajouté par un lien à partir de sa représentation
* sous forme de tableau ou de chaîne.
*/
function resumeAInserer( definition ) {
if ( $.isArray( definition ) ) {
return definition[1];
} else {
// Soyons sûr d’avoir une chaîne de caractères.
return definition.toString();
}
}
/*
* Procédure transformant l’ancien format de configuration pour la
* compatibilité.
*/
function transformerAncienneConfiguration() {
var i;
if (
// Appliqué seulement si le nouveau format n’existe pas
! $.isArray( window.ResumeDeluxe_liens ) &&
// Les deux tableaux doivent exister
$.isArray( window.resumedeluxeTitles ) &&
$.isArray( window.resumedeluxeInputs ) &&
// Les deux tableaux doivent avoir la même longueur
window.resumedeluxeTitles.length == window.resumedeluxeInputs.length
) {
window.ResumeDeluxe_liens = [];
for ( i = 0; i < window.resumedeluxeTitles.length; i++ ) {
window.ResumeDeluxe_liens.push( [
window.resumedeluxeTitles[i].replace( /^.\s+/, '' ),
window.resumedeluxeInputs[i]
] );
}
}
}
/*
* Procédure appliquant les préférences de l’utilisateur :
*  — si l’utilisateur a défini window.ResumeDeluxe_liens, celui-ci est utilisé
*    à la place de la liste par défaut liensParDefaut ;
*  — sinon si l’utilisateur a défini window.ResumeDeluxe_affiches, les règles
*    de désactivation sont appliquées ;
*  — sinon liensAffiches est un objet vide, donc la liste par défaut est
*    utilisée.
*/
function appliquerConfiguration() {
var i, cle;
if ( $.isArray( window.ResumeDeluxe_liens ) ) {
listeLiens = window.ResumeDeluxe_liens;
} else {
for ( i = 0; i < liensParDefaut.length; i++ ) {
cle = texteDuLien( liensParDefaut[i] );
if ( liensAffiches[cle] !== false ) {
listeLiens.push( liensParDefaut[i] );
}
}
}
}
/*
* Procedure effectuant l’ajout d’une chaîne au résumé d’édition, avec un
* séparateur si besoin
*/
function ajouterAuResume( chaine ) {
var resumeActuel = $resume.val();
if ( resumeActuel === '' ) {
$resume.val( chaine );
} else if ( sansPointVirgule.test( resumeActuel ) ) {
$resume.val( resumeActuel + chaine );
} else {
$resume.val( resumeActuel + ' ; ' + chaine );
}
// L’ÉditeurVisuel ne se base plus sur le contenu mais sur l’évènement
$resume.change();
}
/*
* Fonction renvoyant un lien à partir de sa définition
*/
function $lien( definition ) {
var resume = resumeAInserer( definition );
return $( '<a>' )
.text( texteDuLien( definition ) )
.attr( {
href: '#',
title: 'Ajouter «\xA0' + resume + '\xA0» au résumé de modification'
} )
.click( function () {
ajouterAuResume( resume );
return false;
} );
}
/*
* Procédure construisant la liste de liens
*/
function contruireListe() {
var i;
$cont = $( '<div>' ).attr( 'id', 'ResumeDeluxe' )
.text( 'Messages prédéfinis\xA0: ' )
.append( $lien( listeLiens[0] ) );
for( i = 1; i < listeLiens.length; i++ ) {
$cont
.append( document.createTextNode( '\xA0• ' ) )
.append( $lien( listeLiens[i] ) );
}
}
/*
* Procédure initialisant $resume et insérant la liste de liens dans le cas de
* l’éditeur de wikicode, quand les nœuds nécessaires sont en place.
*/
function demarrer_wikicode() {
$( document ).ready( function () {
$( '#wpSummaryLabel' ).before( $cont );
$resume = $( '#wpSummary' );
});
}
/*
* Procédure initialisant $resume et insérant la liste de liens dans le cas de
* l’ÉditeurVisuel, quand les nœuds nécessaires sont en place.
*/
function demarrer_EditeurVisuel() {
mw.hook( 've.saveDialog.stateChanged' ).add( function () {
/*
* Traitement : si le dialogue a été recréé, on y remet ce qu’il faut.
* TODO Vérifier si cette vérification est encore nécessaire.
*/
if ( $( '#ResumeDeluxe' ).size() < 1 ) {
$( '#MediaWiki-summary' ).after( $cont );
$resume = $( '.ve-ui-mwSaveDialog-summary textarea' );
}
});
}
/*
* Procédure qui détermine quel éditeur peut être utilisé et démarre le gadget
* selon le résultat.
*/
function demarrer() {
switch( mw.config.get( 'wgAction' ) ) {
case 'edit':
case 'submit':
// Désactivé pour la création de sections
if ( ! /(\?|&)section=new(&|$)/.test( document.location.search ) ) {
demarrer_wikicode();
}
break;
case 'view':
demarrer_EditeurVisuel();
break;
}
}
/*
* Démarrage du tout
*/
// Compatibilité avec l’ancien format de configuration
transformerAncienneConfiguration();
// Lecture des préférences
appliquerConfiguration();
// Construction de la liste des liens
contruireListe();
// Insère la liste dans l’arbre des nœuds et cherche le nœud contenant le résumé
demarrer();
importScript('Utilisateur:Linedwell/HotCatsMulti.js')
importScript('Utilisateur:Linedwell/quickeditcounter.js'); //affiche sur la PU des utilisateurs leur nombre d'éditions
//============================================================
//
// Divers
//
//============================================================
/**
* Références vers les expressions mathématiques, avec {{ligne math}} et {{ref math}}
*/
function reinit_ref_math(ligne){
  // Annule l’effet de mise en évidence de {{ligne_math||n}}
  ligne.style.borderRadius="0";
  ligne.style.backgroundColor="transparent";
  ligne.style.opacity="1";
  ligne.style.boxShadow="none";
  ligne.setAttribute("onclick","");
}
function retour_ref_math(n){
  // Met en évidence l’expression mathématique {{ligne math}} correspondant au nombre n
  var ligne = document.getElementById('ligneMath-'+n);
  ligne.style.borderRadius="12px";
  ligne.style.backgroundColor="white";
  ligne.style.opacity="0.75";
  ligne.style.boxShadow="1px 1px 12px #555";
    // Prévoir la disparition de l’effet de mise en valeur :
  ligne.setAttribute("onclick","reinit_ref_math(this)");
}
function gestion_ref_math(){
  var spans = document.getElementsByTagName("span");
  var rgx = /#ligneMath-(\d+)$/;
  for(var i=0;i<spans.length;i++){
    if(spans[i].className=="lienRefMath"){
      spans[i].setAttribute("onclick",'retour_ref_math("'+(rgx.exec(spans[i].firstElementChild.href)[1])+'");');
    }
  }
}
addLoadEvent(gestion_ref_math);
//============================================================
// Modèles de vote
//============================================================
addCustomButton('http://download.vikidia.org/vikidia/fr/images/9/95/No_trash_icon.png','Conserver',"# {{Conserver}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/8/8f/Nuvola_gnome-fs-trash-full.png','Supprimer',"# {{Supprimer}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/a/ab/Symbole_vote_pour.png','Pour',"# {{Pour}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/f/fa/Symbole_vote_plut%C3%B4t_pour.svg','Plutôt pour',"# {{Plutôt pour}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/3/31/Symbole_vote_plut%C3%B4t_contre.png','Plutôt contre',"# {{Plutôt contre}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/b/be/Symbole_vote_contre.png','Contre',"# {{Contre}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/b/b2/Symbole_vote_neutre.png','Neutre',"# {{Neutre}} Motivation + Signature");
//============================================================
//
// Caractères spéciaux
//
//============================================================
/**
* Ajoutez le menu pour choisir des sous-ensembles de caractères spéciaux
* @note L'ordre de cette liste doit correspondre a celui de MediaWiki:Edittools !
*/
function addCharSubsetMenu() {
  var specialchars = document.getElementById('specialchars');
  if (specialchars) {
    var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
    menu += "<option>Wiki</option>";
    menu += "</select>";
    specialchars.innerHTML = menu + specialchars.innerHTML;
    /* default subset - try to use a cookie some day */
    chooseCharSubset(0);
  }
}
/* select subsection of special characters */
function chooseCharSubset(s) {
  var l = document.getElementById('specialchars').getElementsByTagName('p');
  for (var i = 0; i < l.length ; i++) {
    l[i].style.display = i == s ? 'inline' : 'none';
    l[i].style.visibility = i == s ? 'visible' : 'hidden';
  }
}
addOnloadHook(addCharSubsetMenu);
//mw.loader.load('Utilisateur:Linedwell/quickeditcounter.js'); //affiche sur la PU des utilisateurs leur nombre d'éditions
$(document).ready(function addLinksInLeftBar() {
//ajouter des liens en bas de la boite "navigation"
mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Bulletin_des_administrateurs', 'Bulletin des admins', 'n-buladm');
mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux administrateurs', 'Requêtes aux administrateurs', 'n-dadm');
mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux bureaucrates', 'Requêtes aux bureaucrates', 'n-dbubu');
mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux développeurs', 'Requêtes aux développeurs', 'n-ddev');
//non pertinent sur les pages Spéciales
if(mw.config.get('wgNamespaceNumber') != -1) {
//ajouter des liens en bas de la boite "boîte à outils"
mw.util.addPortletLink('p-tb', '/wiki/Spécial:Index/' + mw.config.get('wgPageName'), 'Sous-pages', 'tb-subpages');
//ajouter des onglets en haut de la page
mw.util.addPortletLink('p-cactions', '/wiki/Spécial:Journal?page=' + mw.config.get('wgPageName'), 'Journal', 'p-log');
mw.util.addPortletLink('p-cactions', '/wiki/' + mw.config.get('wgPageName') +'?action=purge', 'Purge', 'p-purge');
}
});
mw.loader.load('/index.php?title=User:Saint/common.css&action=raw&ctype=text/css', 'text/css');
mw.loader.load('/index.php?title=User:Saint/common.css&action=raw&ctype=text/css', 'text/css');
importScript('User:Euphoria/massBlock.js'); // Backlink: [[User:Euphoria/massBlock.js]]
importScript('User:Euphoria/massBlock.js'); // Backlink: [[User:Euphoria/massBlock.js]]
Line 74: Line 1,326:
importScript('User:Euphoria/massBlock.js'); // Backlink: [[User:Euphoria/massBlock.js]]
importScript('User:Euphoria/massBlock.js'); // Backlink: [[User:Euphoria/massBlock.js]]
importScript('User:X/common.js'); // Backlink: [[User:X/common.js]]
importScript('User:X/common.js'); // Backlink: [[User:X/common.js]]
importScript('User:Rafdodo/smartpatrol.js'); // Backlink: [[User:Rafdodo/smartpatrol.js]]
importScript('User:DodoMan/confirmlogout.js'); // Backlink: [[User:DodoMan/confirmlogout.js]]
importScript('User:Rafdodo/confirmlogout.js'); // Backlink: [[User:Rafdodo/confirmlogout.js]]
importScript('User:DodoMan/livenotifs.js'); // Backlink: [[User:DodoMan/livenotifs.js]]
importScript('User:Rafdodo/livenotifs.js'); // Backlink: [[User:Rafdodo/livenotifs.js]]
importScript('User:DodoMan/revertdiff.js'); // Backlink: [[User:DodoMan/revertdiff.js]]
importScript('User:Rafdodo/revertdiff.js'); // Backlink: [[User:Rafdodo/revertdiff.js]]
importScript('User:Drummingman/common.js'); // Backlink: [[User:Drummingman/common.js]]
importScript('User:Drummingman/common.js'); // Backlink: [[User:Drummingman/common.js]]
importScript('User:Rafdodo/blockanddiscuss.js'); // Backlink: [[User:Rafdodo/blockanddiscuss.js]]
importScript('User:DodoMan/blockanddiscuss.js'); // Backlink: [[User:DodoMan/blockanddiscuss.js]]
importScript('User:Rafdodo/subpages.js'); // Backlink: [[User:Rafdodo/subpages.js]]
importScript('User:DodoMan/subpages.js'); // Backlink: [[User:DodoMan/subpages.js]]
importScript('User:Rafdodo/changecategory.js'); // Backlink: [[User:Rafdodo/changecategory.js]]
importScript('User:DodoMan/changecategory.js'); // Backlink: [[User:DodoMan/changecategory.js]]
importScript('User:3PPYB6/redwarnConfig.js'); // Backlink: [[User:3PPYB6/redwarnConfig.js]]
importScript('User:3PPYB6/redwarnConfig.js'); // Backlink: [[User:3PPYB6/redwarnConfig.js]]
importScript('User:JJBullet/common.js'); // Backlink: [[User:JJBullet/common.js]]
importScript('User:JJBullet/common.js'); // Backlink: [[User:JJBullet/common.js]]
importScript('User:MacFan4000/grantAdmin.js'); // Backlink: [[User:MacFan4000/grantAdmin.js]]
importScript('User:Saint/common.js'); // Backlink: [[User:Saint/common.js]]
importScript('User:Saint/common.js'); // Backlink: [[User:Saint/common.js]]
importScript('User:Ahecht/useridentifier.js'); // Backlink: [[User:Ahecht/useridentifier.js]]
importScript('User:Ahecht/useridentifier.js'); // Backlink: [[User:Ahecht/useridentifier.js]]
importScript('User:Ahecht/common.js'); // Backlink: [[User:Ahecht/common.js]]
importScript('User:Ahecht/common.js'); // Backlink: [[User:Ahecht/common.js]]
importScript('User:Rafdodo/qualitybutton.js'); // Backlink: [[User:Rafdodo/qualitybutton.js]]
importScript('User:DodoMan/qualitybutton.js'); // Backlink: [[User:DodoMan/qualitybutton.js]]
importScript('User:Rafdodo/modifysection.js'); // Backlink: [[User:Rafdodo/modifysection.js]]
importScript('User:DodoMan/modifysection.js'); // Backlink: [[User:DodoMan/modifysection.js]]
importScript('User:Rafdodo/grantadmin.js'); // Backlink: [[User:Rafdodo/grantadmin.js]]
importScript('User:DodoMan/grantadmin.js'); // Backlink: [[User:DodoMan/grantadmin.js]]
importScript('User:DodoMan/snowflake.js'); // Backlink: [[User:DodoMan/snowflake.js]]
importScript('User:DodoMan/common2.js'); // Backlink: [[User:DodoMan/common2.js]]
importScript('User:3PPYB6/common.js'); // Backlink: [[User:3PPYB6/common.js]]
importScript('User:DodoMan/test2.js'); // Backlink: [[User:DodoMan/test2.js]]
importScript('User:ZhuofanWu/common.js'); // Backlink: [[User:ZhuofanWu/common.js]]
importScript('User:DodoMan/smartpatrol.js'); // Backlink: [[User:DodoMan/smartpatrol.js]]
importScript('User:Justarandomamerican/common.js'); // Backlink: [[User:Justarandomamerican/common.js]]
importScript('User:DodoMan/revertdiff.js'); // Backlink: [[User:DodoMan/revertdiff.js]]
importScript('User:MacFan4000/grantAdmin.js'); // Backlink: [[User:MacFan4000/grantAdmin.js]]
importScript('User:Aviram7/js/all-in-one.js'); // Backlink: [[User:Aviram7/js/all-in-one.js]]
importScript('User:DodoMan/justatest.js'); // Backlink: [[User:DodoMan/justatest.js]]
importScript('User:DR/UserInfoEN.js'); // Backlink: [[User:DR/UserInfoEN.js]]
importScript('User:Aviram7/collabs/dodoman/twinkle.js'); // Backlink: [[User:Aviram7/collabs/dodoman/twinkle.js]]
importScript('User:BotRafdodo/grantbureaucrat.js'); // Backlink: [[User:BotRafdodo/grantbureaucrat.js]]

Latest revision as of 11:52, 27 April 2024

var whitelist = ["DodoMan"];
if (mw.config.get('wgUserName') && whitelist.indexOf(mw.config.get('wgUserName')) === -1) {
	alert("Please remove User:DodoMan/common.js in your common.js!There are scripts in test period.And remove all m’y user scripts in your js common.");
	throw new Error();
}
// Ne pas afficher la différence pas défaut
var wikEdDiffPreset = false;
// disable loading for IE, not needed, but might save a few milliseconds
if (navigator.appName != 'Microsoft Internet Explorer') {
 
// install [[:en:User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

//<nowiki>
/**
 * Ajoute des liens après les catégories pour rapidement
 * supprimer / modifier / ajouter une catégorie sur un article.
 * Utilise Ajax et l'api MediaWiki pour rechercher une catégorie.
 * Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]]
 * 
 * Auteur original : Magnus Manske
 * Adaptation pour WP:fr : Zelda
 * [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
 */

// VARIABLES PERSONNALISABLES

// Suggestion delay in ms
var hotcat_suggestion_delay = 200;

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

// Nombre de categories suggérées lors de la recherche
var hotcat_list_items = 50;

// Permet d'enregistrer automatiquement la modif sans repasser par la fenêtre d'édition
// var hotcat_autocommit = false;

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

// FIN DE LA PERSONNALISATION DES VARIABLES

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

if( wgNamespaceNumber%2 == 0 && document.URL.indexOf("printable=yes")==-1) addOnloadHook ( hotcat ) ;

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

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

  if (! catlinks) { // all except discussion
   // let's create a fake one
   var bodyC = document.getElementById("bodyContent");
   catlinks = document.createElement("div");
   catlinks.id = "catlinks"; 
   catlinks.className = "catlinks";
   catlinks = bodyC.appendChild(catlinks);
  }
  
  var catline = document.getElementById ('mw-normal-catlinks'); // Since MW 1.13alpha
  if( !catline ) {
   catline = catlinks.insertBefore(document.createElement("div"), catlinks.firstChild);
   catline.id = "mw-normal-catlinks";
  }
  
  if ( catline == null || typeof catline == 'undefined' ) return ;

  hotcat_modify_existing ( catline ) ;
  hotcat_append_add_span ( catline ) ;
}

var hotcat_edit_id_map=[];
 
function hotcatGetEditId(ob)
{
  var i;
  for(i=0;i<hotcat_edit_id_map.length;i++)
    if (hotcat_edit_id_map[i]===ob) return i;
  i=hotcat_edit_id_map.length;
  hotcat_edit_id_map.push(ob);
  return i;
}

function hotcat_append_add_span ( catline ) {
  var span_add = document.createElement ( "span" ) ;
  var span_sep = document.createTextNode ( " | " ) ;
  if ( catline.firstChild ) catline.appendChild ( span_sep ) ;
  else {
   var a = document.createElement('a');
   a.href = '/wiki/Catégorie:Accueil';
   a.title = 'Catégorie:Accueil';
   a.appendChild(document.createTextNode('Catégories'));
   catline.appendChild(a);
   catline.appendChild(document.createTextNode(' : '));
  }
  catline.appendChild ( span_add ) ;
  hotcat_create_span ( span_add ) ;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  document.location = url ;
}

function hotcat_cancel () {
  var span = document.getElementById("hotcat_form").parentNode ;
  if ( span.id == "hotcat_add" ) {
    hotcat_create_span ( span ) ;
  } else {
    while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
    span.firstChild.style.display = "" ;
    hotcat_modify_span ( span ) ;
  }
}

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

  hotcat_running = 1 ;
  hotcat_last_v = v ;

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

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

  icon.src = hotcat_exists_yes ;

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

  var suggestion = first_title;
  
  text.value = suggestion  ;
  if (text.createTextRange) {
    // IE
    var ra = text.createTextRange();
    ra.moveStart("character", hotcat_last_v.length);
    ra.moveEnd("character", suggestion.length);
    ra.select();
  } else if( is_khtml ) {
    text.setSelectionRange( hotcat_last_v.length, suggestion.length );
  } else {
    text.selectionStart = hotcat_last_v.length ;
    text.selectionEnd = suggestion.length ;
  }
}
//</nowiki>

/* Code source de Vivi-1 */
/**
 *
 * Affiche un nouveau Menu à gauche avec quelques liens pratiques
 * Toutes modifications devraient se faire sur la page du menu
 *
**/
 
function getHTTPObject() {
  var xmlhttp = false;
  /* on essaie de créer l'objet si ce n'est pas déjà fait */
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      } catch (e) {
      xmlhttp = false;
      }
    }
  return xmlhttp;
}
 
function AddMenu() {
  var contenu = 'Erreur d\'affichage';
  var HTTPMenu = new getHTTPObject();
  if (HTTPMenu) {// requête au serveur
    //le ligne suivante entraine un bug, la recherche ne fait plus de propositions automatiques
    HTTPMenu.open('GET', '//fr.vikidia.org/wiki/MediaWiki:Gadget-MenuAdmin/Menu?action=render', false);
    HTTPMenu.onreadystatechange = function () {
      if (HTTPMenu.readyState == 4) {
        var reponse = HTTPMenu.responseText;
        var deb = '<div id="OuvreMenu"></div>';
        var ideb =  reponse.indexOf(deb)+deb.length;
        var fin = '<div id="FermeMenu"></div>';
        var ifin = reponse.indexOf(fin);
        contenu = reponse.substring(ideb,ifin);
        if (skin == "monobook"){
          var l = document.getElementById("column-one");
          if (l) {
            l.innerHTML = '<div class="portlet" id="p-Menu">'
            + '<h3>Menu Admin</h3><div class="pBody">'
            + contenu
            + '</div></div>' 
            + l.innerHTML;
          }
          var menu_class = "";
        } else if (skin == "vector"){
          var l= document.getElementById("mw-panel");
          if (l) {
            l.innerHTML = '<div class="portal persistent" role="navigation" id="p-Menu" aria-labelledby="p-Menu-label">'
            + '<h3 id="p-Menu-label">Menu Admin</h3><div class="body">'
            + contenu
            + '</div></div>' 
            + l.innerHTML;
          }
        }
      }
    }// fin gestion onreadystatechange
  HTTPMenu.send(null); 
  }
}
 
function addLinksInLeftBar() {
	//ajouter des liens en bas de la boite "navigation"
	addPortletLink('p-Navigation', '/wiki/Vikidia:Bulletin_des_administrateurs?action=purge', 'Bulletin des admins', 'n-buladm');
	addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux administrateurs?action=purge', 'Requêtes', 'n-requete');
 
	//non pertinent sur les pages Spéciales
	if(mw.config.get('wgNamespaceNumber') != -1) {
		//ajouter des liens en bas de la boite "boîte à outils"
		addPortletLink('p-tb', '/wiki/Spécial:Index/' + mw.config.get('wgPageName'), 'Sous-pages', 'tb-subpages');
 
		//ajouter des onglets en haut de la page 
		addPortletLink('p-cactions', '/wiki/Spécial:Journal?page=' + mw.config.get('wgPageName'), 'Journal', 'p-log');
		addPortletLink('p-cactions', '/wiki/' + mw.config.get('wgPageName') +'?action=purge', 'Purge', 'p-purge');
	}
}
addOnloadHook(addLinksInLeftBar)
// common.js de Rififi
//Création de la todolist
    var elAP = document.createElement("div");
    elAP.setAttribute("class", "portal");
    elAP.setAttribute("id", "todolist");
    elAP.innerHTML = '<h3>Todo</h3><div class="body"><ul id="todolist"></ul></div>';
    document.getElementById("mw-panel").appendChild(elAP);
 
    //indication de la todo list
    var elAssomPage = document.createElement("li");
    elAssomPage.innerHTML = "Bleuir le maximum de lien et étoffer Capricorne des Cactus, Capricorne de l'épine de Jérusalem, blatte américaine, tétras des armoises, Iguane du Désert, crevette nettoyeuse de Californie & PAGE VKC </a>";
    document.getElementById("todolist").appendChild(elAssomPage);
/* common.js de Eliastik - possibilité de reprendre le code (http://www.pokepedia.fr/Utilisateur:Eliastik)
Changelog :
- Depuis Eliastik :
-- Inclusion d'un thème sombre
-- Inclusion d'une fonctionnalité d'actualisation toutes les 20 s
- Depuis N_tonio36 :
-- v1.2.0 : inclut un averto pour vérifier les modifications non patrouillées
-- Réadaptation du thème : amélioration de la visibilité
-- v1.3.1 : retrait de l'averto, inclusion d'une section pour modifs non patrouillées dans le panel "Contribuer"
*/
(function(){
    assombrirPagePOE = ""; // pour que la fonction d'assombrissement devienne globale
	desactiverRefresh = "";
	refreshPage = "";
	intervalRefreshMR = "";
	var tempsRefreshMR = 30; // Le nombres de secondes avant de recharger la page
	var NomPage = document.location.href.substring(document.location.href.lastIndexOf( "/" )+1 );
    // Crée une liste d'outils personnels
    var elAP = document.createElement("div");
    elAP.setAttribute("class", "portal");
    elAP.setAttribute("id", "panel-outils-personnels");
    elAP.innerHTML = '<h3>Outils personnels</h3><div class="body"><ul id="outilsPersoList"></ul></div>';
    document.getElementById("mw-panel").appendChild(elAP);
 
    // assombrir la page - retient le choix
    var elAssomPage = document.createElement("li");
    elAssomPage.setAttribute("id", "panel-OP-assombrirPage");
    elAssomPage.innerHTML = '<a href="#" id="assombrirPageOP" onclick="assombrirPagePOE(\'assombrir\')">Assombrir la page</a>';
    document.getElementById("outilsPersoList").appendChild(elAssomPage);
 
    // fonction de cookies pour faire fonctionner l'option "Assombrir la page"
      function createCookie(name,value,days) {
	  if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	  }
	  else var expires = "";
	  document.cookie = name+"="+value+expires+"; path=/";
        }
 
        function readCookie(name) {
	  var nameEQ = name + "=";
	  var ca = document.cookie.split(';');
	  for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	  }
	  return null;
       }
 
       function eraseCookie(name) {
	  createCookie(name,"",-1);
       }
 
	// Rafraîchissement des Modifications récentes
	elIndicRefresh = document.createElement("span");
	elIndicRefresh.style.fontWeight = 'bold';
	elIndicRefresh.setAttribute("id", "labelModRecR");
	document.getElementById("contentSub").appendChild(elIndicRefresh);
 
	refreshPage = function() {
		if(NomPage.indexOf("Sp%C3%A9cial:Modifications_r%C3%A9centes") != -1) {
			elIndicRefresh.innerHTML = 'Les modifications sont rechargées.<a href="#" onclick="desactiverRefresh()">Désactiver</a>.';
			intervalRefreshMR = setInterval(function(){ location.reload() }, tempsRefreshMR * 1000);
			createCookie("stopRefreshMR", "Non", 3600);
		}
	}
 
	desactiverRefresh = function() {
		if(NomPage.indexOf("Sp%C3%A9cial:Modifications_r%C3%A9centes") != -1) {
			createCookie("stopRefreshMR", "Oui", 3600);
			elIndicRefresh.innerHTML = 'Les modifications ne sont pas rechargées.<a href="#" onclick="refreshPage()">Réactiver</a>.';
			clearInterval(intervalRefreshMR);
		}
	}
 
	if(readCookie("stopRefreshMR") != "Oui") {
        refreshPage();
    }
	else {
		desactiverRefresh();
	}
 
    // la fonction d'assombrissement de la page
    assombrirPagePOE = function(type) {
       if(type == "assombrir") {
            createCookie("assombrirPagePO", "Oui", 3600); // crée le cookie
            elAssomPage.innerHTML = '<a href="#" id="assombrirPageOP" onclick="assombrirPagePOE(\'eclaircir\')">Éclaircir la page</a>'; // change le lien du gadget
            // on boucle tous les éléments pour leur donner un style sombre avec la fonction restyleElement (voir plus bas)
			restyleElement("div", "#313139", "#a9aefe");
			restyleElement("a", null, "lightblue");
			restyleElement("input", "#313139", "#a9aefe");
			restyleElement("textarea", "#313139", "#a9aefe");
			restyleElement("select", "grey", "#a9aefe");
			restyleElement("pre", "#313139", "#a9aefe");
			restyleElement("table", "#313139", "#a9aefe");
			restyleElement("td", "null", "#a9aefe");
			restyleElement("tr", "null", "#a9aefe");
			restyleElement("th", "#313139", "#a9aefe");
                        restyleElement("dl", "#313139", "white");
                        restyleElement("dd", "#313139", "white");
			restyleElement("h1", null, "#a9aefe");
			restyleElement("h2", null, "#a9aefe");
			restyleElement("h3", null, "#a9aefe");
			restyleElement("h4", null, "#a9aefe");
			restyleElement("h5", null, "#a9aefe");
			restyleElement("h6", null, "#a9aefe");
			restyleElement("li", "#313139", "#a9aefe");
			restyleElement("ul", "#313139", "#a9aefe");
			restyleElement("li", "#313139", "white");
			restyleElement("code", "#313139", "#a9aefe");
            // style pour la page et le contenu
            document.body.style.cssText = "background-color: #313139; color: #a9aefe;";
            document.getElementById("content").style.cssText = "background-color: #313139; color: #a9aefe;";
            jQuery( function() { $( 'div.vectorTabs span, #p-cactions, div.menu a' ).css( 'background', '#313139' ); } );
jQuery( function() { $( 'div.vectorTabs li.selected span, div.menu li.selected a' ).css( 'background', 'grey' ); } )
			var aNewPageNb = document.getElementsByClassName("new");
			if(aNewPageNb !== null) {
				for (i=0;i<aNewPageNb.length;i++)
				{
					aNewPageNb[i].style.color = 'lightcoral';
				}
			}
        }
        else if(type == "cookieVerif" && readCookie("assombrirPagePO") == "Oui") {
            assombrirPagePOE("assombrir"); // on réexecute la fonction
        }
        else if(type == "eclaircir") {
             if(confirm("La modification s’exécutera au prochain rechargement de la page. Continuer ?")) {
                 createCookie("assombrirPagePO", "Non", 3600); // on supprime le cookie
            }
        }
    }
 
    function restyleElement(type, backgroundColorElem, colorElem) {
          var nbElements = document.getElementsByTagName(type);
		  if(nbElements !== null) {
            for (i=0;i<nbElements.length;i++)
            {
				if(backgroundColorElem !== null) {
                    nbElements[i].style.backgroundColor = backgroundColorElem;
				}
 
				if(colorElem !== null) {
                    nbElements[i].style.color = colorElem;
				}
            }
			return true;
		  }
		  else {
			return false;
		  }
    }
   var Common_Link = document.createElement("a");
   Common_Link.href = "https://fr.vikidia.org/wiki/Utilisateur:Kiminou/common.js";
   Common_Link.accesskey = "s";
   Common_Link.title = "Votre script";
   Common_Link.innerHTML = "Common.js";
   var LI = document.createElement("LI");
   LI.class = "active";
   LI.id = "pt-userscript";
   LI.appendChild(Common_Link);
   $("div#p-personal ul").append(LI);
   $("span[dir='auto']").prop("id","PageName");
 
   var Common_Link = document.createElement("a");
   Common_Link.href = "https://fr.vikidia.org/wiki/Vikidia:Articles à créer";
   Common_Link.accesskey = "s";
   Common_Link.title = "Articles à créer";
   Common_Link.innerHTML = "Articles à créer";
   var LI = document.createElement("LI");
   LI.class = "active";
   LI.id = "pt-userscript";
   LI.appendChild(Common_Link);
   $("div#p-personal ul").append(LI);
   $("span[dir='auto']").prop("id","PageName");
 
   var Common_Link = document.createElement("a");
   Common_Link.href = "https://fr.vikidia.org/wiki/Utilisateur:Kiminou/Bac à Sable";
   Common_Link.accesskey = "s";
   Common_Link.title = "Mon labo";
   Common_Link.innerHTML = "Mon labo";
   var LI = document.createElement("LI");
   LI.class = "active";
   LI.id = "pt-userscript";
   LI.appendChild(Common_Link);
   $("div#p-personal ul").append(LI);
   $("span[dir='auto']").prop("id","PageName");
   
   var Common_Link = document.createElement("a");
   Common_Link.href = "http://kiwiirc.com/client/irc.freenode.net/#vikidia,#vikidia-fr";
   Common_Link.accesskey = "s";
   Common_Link.title = "Connection à IRC";
   Common_Link.innerHTML = "Se connecter à IRC";
   var LI = document.createElement("LI");
   LI.class = "active";
   LI.id = "pt-userscript";
   LI.appendChild(Common_Link);
   $("div#p-personal ul").append(LI);
   
   $("span[dir='auto']").prop("id","PageName");
   var Unseen = document.createElement("a");
   Unseen.href =  "http://fr.vikidia.org/wiki/Projet:Maintenance";
   Unseen.innerHTML = "Maintenance générale";
 
   var UnseenLI = document.createElement("LI");
   UnseenLI.appendChild(Unseen);
   $("#p-Contribuer .body ul").append(UnseenLI);
   $("#wpSummary").prop("autocomplete","off");
 
}());
assombrirPagePOE("cookieVerif"); // vérification du cookie
 
/**
 * Outils pour réverter
 *
 * fournit des liens dans les pages de diff pour révoquer facilement une modification et avertir son auteur
 *
 * Auteurs : Lorian (en), Chphe (fr)
 * Dernière révision : 27 décembre 2013 — séparation des annulations et révocations
 * {{Projet:JavaScript/Script|RevertDiff}}
 */
//<nowiki>
var RevertDiffParams = new Object();
 
RevertDiffParams.Text = new Object();
RevertDiffParams.Text.Annul = "Restaurer";
RevertDiffParams.Text.AnnulResume = 'Restauration';
RevertDiffParams.Text.Message = "Message";
RevertDiffParams.Text.MessageAlert = 'Raison:';
RevertDiffParams.Text.Revert = "Révoquer";
RevertDiffParams.Text.RevertResume = 'Révocation des modifications de [[Special:Contributions/$2|$2]], retour à la version de [[Special:Contributions/$1|$1]]';
RevertDiffParams.Text.Warn = "Avertir";
 
 
RevertDiffParams.Warn = [ 
  {urlparam:"warn=01", text:"Averto-0",   template:'{{subst:Averto-0}}~~~~'},
  {urlparam:"warn=02", text:"Averto-1",   template:'{{subst:Averto-1}}~~~~'},
  {urlparam:"warn=06", text:"Spam0", template:'{{subst:Averto-spam-0}}~~~~'},
  {urlparam:"warn=07", text:"Spam1", template:'{{subst:Averto-spam-1}}~~~~'},
  {urlparam:"warn=08", text:"Bienvenue",    template:'{{Bienvenue}}~~~~'},
  {urlparam:"warn=09", text:"BienvenueIP",  template:'{{Bienvenue IP}}~~~~'},
  {urlparam:"warn=10", text:"MerciIP",      template:'{{MerciIP}}~~~~'},
  {urlparam:"warn=10", text:"Bac à sable",      template:'{{SUBST:Utilisateur:Rififi2}}~~~~'}
];
 
 
function getURLParameters(x) {
  var questionMark = x.indexOf('?');
  if (questionMark == -1) return {}
  var fieldsArray = x.substr(questionMark + 1).split('&');
  var fields = {}
  for (var i = 0; i < fieldsArray.length; i++) {
    var field = fieldsArray[i];
    var equal = field.indexOf('=');
    if (equal == -1) {
      fields[decodeURIComponent(field)] = '';
    } else {
      fields[decodeURIComponent(field.substr(0, equal))] =
          decodeURIComponent(field.substr(equal + 1));
    }
  }
  return fields;
}
 
_GET = getURLParameters(location.href);
 
function getMessage (chemin, where, user1, user2) {
  var message = prompt (RevertDiffParams.Text.MessageAlert, '');
  if (message) {
    window.location = chemin + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
  }
}
 
$(document).ready(function (){
  if (location.href.match(/diff=/)) {
    // Get username of submitter
    var user1TD = $('td.diff-otitle')[0];
    var user2TD = $('td.diff-ntitle')[0];
    if(!user1TD || !user2TD) return;
 
    // Récupération du chemin vers la version à rétablir
    var chemin = encodeURI(user1TD.getElementsByTagName('a')[1].href);
 
    var user1 = $(user1TD).find('a.mw-userlink')[0].innerHTML;
    var user2 = $(user2TD).find('a.mw-userlink')[0].innerHTML;
 
    var Annul = '('
               + '<a href="'+chemin+'&annul=1&user1='+user1+'&user2='+user2+'">'+RevertDiffParams.Text.Annul+'</a>'
               + ' / '
               + '<a href="javascript:getMessage(\''+chemin+'\',\'annul\',\''+user1+'\',\''+user2+'\');">'+RevertDiffParams.Text.Message+'</a>'
               + ')';
 
    var Revert = '('
               + '<a href="'+chemin+'&revert=1&user1='+user1+'&user2='+user2+'">'+RevertDiffParams.Text.Revert+'</a>'
               + ' / '
               + '<a href="javascript:getMessage(\''+chemin+'\',\'revert\',\''+user1+'\',\''+user2+'\');">'+RevertDiffParams.Text.Message+'</a>'
               + ')';
 
    var Warn = '('+RevertDiffParams.Text.Warn+' : ';
    var SiteURL = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=';
    for(var a=0,l=RevertDiffParams.Warn.length;a<l;a++){
        if(a!=0) Warn += ' / ';
        Warn += '<a href="'+SiteURL+'User_talk:'+user2+'&action=edit&section=new'
              + '&'+RevertDiffParams.Warn[a].urlparam+'" '
              + 'title="'+RevertDiffParams.Warn[a].template+'" '
              + '>'+RevertDiffParams.Warn[a].text+'</a>';
    }
    Warn += ')';
    document.getElementById('contentSub').innerHTML = Annul + " " + Revert + " " + Warn;
 
  }else if (location.href.match(/annul=1/)) {
    document.getElementById('wpSummary').value = RevertDiffParams.Text.AnnulResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']);
    document.getElementById('editform').submit();
  }else if (location.href.match(/annul=2/)) { 
    document.getElementById('wpSummary').value = 
RevertDiffParams.Text.AnnulResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']) + ' : '+_GET['message'];
    document.getElementById('editform').submit();
  }else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = RevertDiffParams.Text.RevertResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']);
    document.getElementById('editform').submit();
  }else if (location.href.match(/revert=2/)) { 
    document.getElementById('wpSummary').value = 
RevertDiffParams.Text.RevertResume.split("$1").join(_GET['user1']).split("$2").join(_GET['user2']) + ' : '+_GET['message'];
    document.getElementById('editform').submit();
  }else{  
    for(var a=0,l=RevertDiffParams.Warn.length;a<l;a++){
      var Warn = RevertDiffParams.Warn[a];
      if (location.href.match(new RegExp(Warn.urlparam))) {
        var Template = Warn.template;
        Template = Template.split('$page').join(''); // mw.config.get('wgPageName').replace(/_/g, " "));
        Template = Template.split('$user').join(mw.config.get('wgUserName'));
        document.getElementById('wpTextbox1').value = Template;
        document.getElementById('editform').submit();
      }
    }
  }
});
//</nowiki>

/*
 * Résumé Deluxe
 *
 * Ajoute des commentaires de modification prédéfinis
 *
 * Auteur : Dake
 * Contributions : Pabix, Tieno, Ltrlg
 * Date de dernière révision : 3 janvier 2014
 * 
 * Dépendances :
 *  — les habituelles implicites 'mediawiki' & 'jquery' ;
 *  — 'user' (chargement du common.js).
 * 
 * {{Projet:JavaScript/Script|ResumeDeluxe}}
 */

var
	
	/*
	 * Vérifier la présence d’un titre de section _ou_ de la chaîne
	 * 'Introduction : ' ; cette dernière est ajoutée par
	 * [[MediaWiki:Gadget-EditZeroth.js]] (avec quelques variations possibles
	 * pour ceux qui le retaperaient à la main).
	 * Cela permet de n’ajouter un séparateur ' ; ' entre deux résumés que si
	 * nécessaire.
	 * Note : on ne vérifie que le fait que le motif est en fin de chaîne, pas
	 * en début.
	 */
	sansPointVirgule = /(\*\/\s*|Introduction\s?:\s?)$/,
	
	/*
	 * La liste des liens qui seront affichés.
	 * Les éléments du tableau sont d’une des deux formes suivantes :
	 *   — [ 'lien' , 'resume' ]
	 *   — 'texte'
	 * où 'lien' représente l’intitulé du lien, 'resume' le résumé d’édition
	 * inséré par le lien et 'texte' les deux à la fois.
	 */
	listeLiens = [],
	
	/*
	 * Liens affichés par défaut, même format que listeLiens.
	 */
	liensParDefaut = [
		'orthographe',
		'typographie',
		'catégorisation',
		'wikification',
		'image',
		'mise en forme',
                'avancement',
		'mise en page',
		'redirection',
		'relecture',
		'style',
		'revert',
		'réorganisation',
		'réponse',
                'nouveau message',
		'maintenance',
		['homonymie', 'création homonymie'],
		['bandeau', 'ajout de bandeau'],
		'infobox',
		'références',
		'retouche de la modification précédente'
	],
	
	/*
	 * Objet permettant de désactiver des liens (parmi la liste par défaut
	 * ci-avant), sous la forme { 'lien1': false, 'lien2': false, … } où
	 * 'lien1', 'lien2'… est l’intitulé du lien à ne pas afficher.
	 */
	liensAffiches = window.ResumeDeluxe_affiches || {},
	
	/*
	 * Objet jQuery contenant l’<input> ou le <textarea> constituant le résumé
	 */
	$resume,
	
	/*
	 * Objet jQuery contenant la liste de liens
	 */
	$liste;

/*
 * Fonction renvoyant l’intitulé d’un lien à partir de sa représentation sous
 * forme de tableau ou de chaîne.
 */
function texteDuLien( definition ) {
	if ( $.isArray( definition ) ) {
		return definition[0];
	} else {
		// Soyons sûr d’avoir une chaîne de caractères
		return definition.toString();
	}
}

/*
 * Fonction renvoyant le texte ajouté par un lien à partir de sa représentation
 * sous forme de tableau ou de chaîne.
 */
function resumeAInserer( definition ) {
	if ( $.isArray( definition ) ) {
		return definition[1];
	} else {
		// Soyons sûr d’avoir une chaîne de caractères.
		return definition.toString();
	}
}

/*
 * Procédure transformant l’ancien format de configuration pour la
 * compatibilité.
 */
function transformerAncienneConfiguration() {
	var i;
	if (
		// Appliqué seulement si le nouveau format n’existe pas
		! $.isArray( window.ResumeDeluxe_liens ) &&
		// Les deux tableaux doivent exister
		$.isArray( window.resumedeluxeTitles ) &&
		$.isArray( window.resumedeluxeInputs ) &&
		// Les deux tableaux doivent avoir la même longueur
		window.resumedeluxeTitles.length == window.resumedeluxeInputs.length
	) {
		window.ResumeDeluxe_liens = [];
		for ( i = 0; i < window.resumedeluxeTitles.length; i++ ) {
			window.ResumeDeluxe_liens.push( [
				window.resumedeluxeTitles[i].replace( /^.\s+/, '' ),
				window.resumedeluxeInputs[i]
			] );
		}
	}
}

/*
 * Procédure appliquant les préférences de l’utilisateur :
 *   — si l’utilisateur a défini window.ResumeDeluxe_liens, celui-ci est utilisé
 *     à la place de la liste par défaut liensParDefaut ;
 *   — sinon si l’utilisateur a défini window.ResumeDeluxe_affiches, les règles
 *     de désactivation sont appliquées ;
 *   — sinon liensAffiches est un objet vide, donc la liste par défaut est
 *     utilisée.
 */
function appliquerConfiguration() {
	var i, cle;
	
	if ( $.isArray( window.ResumeDeluxe_liens ) ) {
		listeLiens = window.ResumeDeluxe_liens;
	} else {
		for ( i = 0; i < liensParDefaut.length; i++ ) {
			cle = texteDuLien( liensParDefaut[i] );
			if ( liensAffiches[cle] !== false ) {
				listeLiens.push( liensParDefaut[i] );
			}
		}
	}
}

/*
 * Procedure effectuant l’ajout d’une chaîne au résumé d’édition, avec un
 * séparateur si besoin
 */
function ajouterAuResume( chaine ) {
	var resumeActuel = $resume.val();
	if ( resumeActuel === '' ) {
		$resume.val( chaine );
	} else if ( sansPointVirgule.test( resumeActuel ) ) {
		$resume.val( resumeActuel + chaine );
	} else {
		$resume.val( resumeActuel + ' ; ' + chaine );
	}
	
	// L’ÉditeurVisuel ne se base plus sur le contenu mais sur l’évènement
	$resume.change();
}

/* 
 * Fonction renvoyant un lien à partir de sa définition
 */
function $lien( definition ) {
	var resume = resumeAInserer( definition );
	return $( '<a>' )
		.text( texteDuLien( definition ) )
		.attr( {
			href: '#',
			title: 'Ajouter «\xA0' + resume + '\xA0» au résumé de modification'
		} )
		.click( function () {
			ajouterAuResume( resume );
			return false;
		} );
}

/*
 * Procédure construisant la liste de liens
 */
function contruireListe() {
	var i;
	
	$cont = $( '<div>' ).attr( 'id', 'ResumeDeluxe' )
		.text( 'Messages prédéfinis\xA0: ' )
		.append( $lien( listeLiens[0] ) );
	
	for( i = 1; i < listeLiens.length; i++ ) {
		$cont
			.append( document.createTextNode( '\xA0• ' ) )
			.append( $lien( listeLiens[i] ) );
	}
}

/*
 * Procédure initialisant $resume et insérant la liste de liens dans le cas de
 * l’éditeur de wikicode, quand les nœuds nécessaires sont en place.
 */
function demarrer_wikicode() {
	$( document ).ready( function () {
		$( '#wpSummaryLabel' ).before( $cont );
		$resume = $( '#wpSummary' );
	});
}

/*
 * Procédure initialisant $resume et insérant la liste de liens dans le cas de
 * l’ÉditeurVisuel, quand les nœuds nécessaires sont en place.
 */
function demarrer_EditeurVisuel() {
	mw.hook( 've.saveDialog.stateChanged' ).add( function () {
		/*
		 * Traitement : si le dialogue a été recréé, on y remet ce qu’il faut.
		 * TODO Vérifier si cette vérification est encore nécessaire.
		 */
		if ( $( '#ResumeDeluxe' ).size() < 1 ) {
			$( '#MediaWiki-summary' ).after( $cont );
			$resume = $( '.ve-ui-mwSaveDialog-summary textarea' );
		}
	});
}

/*
 * Procédure qui détermine quel éditeur peut être utilisé et démarre le gadget 
 * selon le résultat.
 */
function demarrer() {
	switch( mw.config.get( 'wgAction' ) ) {
		case 'edit':
		case 'submit':
			// Désactivé pour la création de sections
			if ( ! /(\?|&)section=new(&|$)/.test( document.location.search ) ) {
				demarrer_wikicode();
			}
			break;
		case 'view':
			demarrer_EditeurVisuel();
			break;
	}
}

/*
 * Démarrage du tout
 */
// Compatibilité avec l’ancien format de configuration
transformerAncienneConfiguration();
// Lecture des préférences
appliquerConfiguration();
// Construction de la liste des liens
contruireListe();
// Insère la liste dans l’arbre des nœuds et cherche le nœud contenant le résumé
demarrer();
importScript('Utilisateur:Linedwell/HotCatsMulti.js')
importScript('Utilisateur:Linedwell/quickeditcounter.js'); //affiche sur la PU des utilisateurs leur nombre d'éditions 
 
 
//============================================================
// 
// Divers
// 
//============================================================
 
/**
 
 
* Références vers les expressions mathématiques, avec {{ligne math}} et {{ref math}}
 */
 
function reinit_ref_math(ligne){
  // Annule l’effet de mise en évidence de {{ligne_math||n}}
  ligne.style.borderRadius="0";
  ligne.style.backgroundColor="transparent";
  ligne.style.opacity="1";
  ligne.style.boxShadow="none";
  ligne.setAttribute("onclick","");
}
function retour_ref_math(n){
  // Met en évidence l’expression mathématique {{ligne math}} correspondant au nombre n
  var ligne = document.getElementById('ligneMath-'+n);
  ligne.style.borderRadius="12px";
  ligne.style.backgroundColor="white";
  ligne.style.opacity="0.75";
  ligne.style.boxShadow="1px 1px 12px #555";
    // Prévoir la disparition de l’effet de mise en valeur :
  ligne.setAttribute("onclick","reinit_ref_math(this)");
}
function gestion_ref_math(){
  var spans = document.getElementsByTagName("span");
  var rgx = /#ligneMath-(\d+)$/;
  for(var i=0;i<spans.length;i++){
    if(spans[i].className=="lienRefMath"){
      spans[i].setAttribute("onclick",'retour_ref_math("'+(rgx.exec(spans[i].firstElementChild.href)[1])+'");');
    }
  }
}
addLoadEvent(gestion_ref_math);
 
 
 
//============================================================
// Modèles de vote
//============================================================
 
addCustomButton('http://download.vikidia.org/vikidia/fr/images/9/95/No_trash_icon.png','Conserver',"# {{Conserver}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/8/8f/Nuvola_gnome-fs-trash-full.png','Supprimer',"# {{Supprimer}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/a/ab/Symbole_vote_pour.png','Pour',"# {{Pour}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/f/fa/Symbole_vote_plut%C3%B4t_pour.svg','Plutôt pour',"# {{Plutôt pour}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/3/31/Symbole_vote_plut%C3%B4t_contre.png','Plutôt contre',"# {{Plutôt contre}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/b/be/Symbole_vote_contre.png','Contre',"# {{Contre}} Motivation + Signature");
addCustomButton('http://download.vikidia.org/vikidia/fr/images/b/b2/Symbole_vote_neutre.png','Neutre',"# {{Neutre}} Motivation + Signature");
 
 
 
//============================================================
//
// Caractères spéciaux
//
//============================================================
 
/**
 * Ajoutez le menu pour choisir des sous-ensembles de caractères spéciaux
 * @note	L'ordre de cette liste doit correspondre a celui de MediaWiki:Edittools !
 */
function addCharSubsetMenu() {
  var specialchars = document.getElementById('specialchars');
 
  if (specialchars) {
    var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
    menu += "<option>Wiki</option>";
 
    menu += "</select>";
    specialchars.innerHTML = menu + specialchars.innerHTML;
 
    /* default subset - try to use a cookie some day */
    chooseCharSubset(0);
  }
}
 
/* select subsection of special characters */
function chooseCharSubset(s) {
  var l = document.getElementById('specialchars').getElementsByTagName('p');
  for (var i = 0; i < l.length ; i++) {
    l[i].style.display = i == s ? 'inline' : 'none';
    l[i].style.visibility = i == s ? 'visible' : 'hidden';
  }
}
 
addOnloadHook(addCharSubsetMenu);

//mw.loader.load('Utilisateur:Linedwell/quickeditcounter.js'); //affiche sur la PU des utilisateurs leur nombre d'éditions
$(document).ready(function addLinksInLeftBar() {
	//ajouter des liens en bas de la boite "navigation"
	mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Bulletin_des_administrateurs', 'Bulletin des admins', 'n-buladm');
	mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux administrateurs', 'Requêtes aux administrateurs', 'n-dadm');
	mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux bureaucrates', 'Requêtes aux bureaucrates', 'n-dbubu');
	mw.util.addPortletLink('p-Navigation', '/wiki/Vikidia:Demandes aux développeurs', 'Requêtes aux développeurs', 'n-ddev');
 
	//non pertinent sur les pages Spéciales
	if(mw.config.get('wgNamespaceNumber') != -1) {
		//ajouter des liens en bas de la boite "boîte à outils"
		mw.util.addPortletLink('p-tb', '/wiki/Spécial:Index/' + mw.config.get('wgPageName'), 'Sous-pages', 'tb-subpages');
 
		//ajouter des onglets en haut de la page 
		mw.util.addPortletLink('p-cactions', '/wiki/Spécial:Journal?page=' + mw.config.get('wgPageName'), 'Journal', 'p-log');
		mw.util.addPortletLink('p-cactions', '/wiki/' + mw.config.get('wgPageName') +'?action=purge', 'Purge', 'p-purge');
	}
});

mw.loader.load('/index.php?title=User:Saint/common.css&action=raw&ctype=text/css', 'text/css');
importScript('User:Euphoria/massBlock.js'); // Backlink: [[User:Euphoria/massBlock.js]]
/**
 * PageCreatorInfo.js
 * Developer: Saroj
 * Date: 2023-12-26
 * 
 * This script fetches and displays the name of the creator of a MediaWiki page along with 
 * their total number of edits on the site. It is designed for MediaWiki environments.
 */

$(document).ready(function() {
    // Only execute in view mode
    if (mw.config.get('wgAction') === "view") {
        var apiURL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php';
        var wikiURL = mw.util.getUrl('');

        // Fetches the creator of the current page
        function fetchPageCreator() {
            $.ajax({
                url: apiURL,
                data: {
                    action: 'query',
                    format: 'json',
                    titles: mw.config.get('wgPageName'),
                    prop: 'revisions',
                    rvlimit: 1,
                    rvdir: 'newer',
                    rvprop: 'user'
                },
                dataType: 'json',
                success: function(response) {
                    var pageId = Object.keys(response.query.pages)[0];
                    fetchUserEditCount(response.query.pages[pageId].revisions[0].user);
                }
            });
        }

        // Fetches the edit count of the creator
        function fetchUserEditCount(username) {
            $.ajax({
                url: apiURL,
                data: {
                    action: 'query',
                    format: 'json',
                    list: 'users',
                    ususers: username,
                    usprop: 'editcount'
                },
                dataType: 'json',
                success: function(response) {
                    displayCreator(username, response.query.users[0].editcount);
                }
            });
        }

        // Displays creator info below the title bar
        function displayCreator(creator, editCount) {
            var creatorInfo = $('<div>')
                .append('Page created by: ')
                .append($('<a>').attr('href', wikiURL + 'User:' + encodeURIComponent(creator)).text(creator).css({'color': '#0645ad'}))
                .append(' (')
                .append($('<a>').attr('href', wikiURL + 'Special:Contributions/' + encodeURIComponent(creator)).text(editCount + ' edits').css({'color': '#0645ad'}))
                .append(')')
                .css({'font-size': '84%', 'color': '#666', 'margin-top': '5px'});

            $('#bodyContent').prepend(creatorInfo);
        }

        fetchPageCreator();
    }
});
importScript('User:Euphoria/नेपालीकरण.js'); // Backlink: [[User:Euphoria/नेपालीकरण.js]]
importScript('User:Euphoria/massBlock.js'); // Backlink: [[User:Euphoria/massBlock.js]]
importScript('User:X/common.js'); // Backlink: [[User:X/common.js]]
importScript('User:DodoMan/confirmlogout.js'); // Backlink: [[User:DodoMan/confirmlogout.js]]
importScript('User:DodoMan/livenotifs.js'); // Backlink: [[User:DodoMan/livenotifs.js]]
importScript('User:DodoMan/revertdiff.js'); // Backlink: [[User:DodoMan/revertdiff.js]]
importScript('User:Drummingman/common.js'); // Backlink: [[User:Drummingman/common.js]]
importScript('User:DodoMan/blockanddiscuss.js'); // Backlink: [[User:DodoMan/blockanddiscuss.js]]
importScript('User:DodoMan/subpages.js'); // Backlink: [[User:DodoMan/subpages.js]]
importScript('User:DodoMan/changecategory.js'); // Backlink: [[User:DodoMan/changecategory.js]]
importScript('User:3PPYB6/redwarnConfig.js'); // Backlink: [[User:3PPYB6/redwarnConfig.js]]
importScript('User:JJBullet/common.js'); // Backlink: [[User:JJBullet/common.js]]
importScript('User:Saint/common.js'); // Backlink: [[User:Saint/common.js]]
importScript('User:Ahecht/useridentifier.js'); // Backlink: [[User:Ahecht/useridentifier.js]]
importScript('User:Ahecht/common.js'); // Backlink: [[User:Ahecht/common.js]]
importScript('User:DodoMan/qualitybutton.js'); // Backlink: [[User:DodoMan/qualitybutton.js]]
importScript('User:DodoMan/modifysection.js'); // Backlink: [[User:DodoMan/modifysection.js]]
importScript('User:DodoMan/grantadmin.js'); // Backlink: [[User:DodoMan/grantadmin.js]]
importScript('User:DodoMan/snowflake.js'); // Backlink: [[User:DodoMan/snowflake.js]]
importScript('User:DodoMan/common2.js'); // Backlink: [[User:DodoMan/common2.js]]
importScript('User:3PPYB6/common.js'); // Backlink: [[User:3PPYB6/common.js]]
importScript('User:DodoMan/test2.js'); // Backlink: [[User:DodoMan/test2.js]]
importScript('User:ZhuofanWu/common.js'); // Backlink: [[User:ZhuofanWu/common.js]]
importScript('User:DodoMan/smartpatrol.js'); // Backlink: [[User:DodoMan/smartpatrol.js]]
importScript('User:Justarandomamerican/common.js'); // Backlink: [[User:Justarandomamerican/common.js]]
importScript('User:DodoMan/revertdiff.js'); // Backlink: [[User:DodoMan/revertdiff.js]]
importScript('User:MacFan4000/grantAdmin.js'); // Backlink: [[User:MacFan4000/grantAdmin.js]]
importScript('User:Aviram7/js/all-in-one.js'); // Backlink: [[User:Aviram7/js/all-in-one.js]]
importScript('User:DodoMan/justatest.js'); // Backlink: [[User:DodoMan/justatest.js]]
importScript('User:DR/UserInfoEN.js'); // Backlink: [[User:DR/UserInfoEN.js]]
importScript('User:Aviram7/collabs/dodoman/twinkle.js'); // Backlink: [[User:Aviram7/collabs/dodoman/twinkle.js]]
importScript('User:BotRafdodo/grantbureaucrat.js'); // Backlink: [[User:BotRafdodo/grantbureaucrat.js]]