Utilisateur:PamMiks/commons.js

Une page de Wikipédia, l'encyclopédie libre.
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

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

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
/* 
 --------------------------------------------------------------------------------------
 ---------LLLL---------III--------------------------RRRRRRRRRR--------CCCCC------------
 ---------LLLL---------III--------------------------RRRRRRRRRRRR----CCCCCCCCC----------
 ---------LLLL--------------------------------------RRR------RRR---CCC-----CCC---------
 ---------LLLL---------III--VV-----VV--EEEEEEEEE----RRR------RRR--CCC------------------
 ---------LLLL---------III---VV---VV---EEE----------RRRRRRRRRRR---CCC------------------
 ---------LLLL---------III---VV---VV---EEEEEE-------RRRRRRRRRR----CCC------------------
 ---------LLLL---------III----VV-VV----EEEEEE-------RRR-----RRR----CCC-----CCC---------
 ---------LLLLLLLLLLL--III----VVVVV----EEE----------RRR------RRR----CCCCCCCCC----------
 ---------LLLLLLLLLLL--III-----VVV-----EEEEEEEEE----RRR-------RRR-----CCCCC------------
 --------------------------------------------------------------------------------------
 
'''Extension de LiveRC'''
 
// Permet d'insérer un bandeau d'article avec paramètres
 
* Licence : ...?
* Documentation : 
* Auteur : [[:it:User:Jalo]] [[:it:User:Rotpunkt]], [[:fr:User:Dr Brains]]
*
* This script contains functions (InserisciTemplate_showDialog, InserisciTemplate_dumpTemplate and InserisciTemplate_buildInputEl)
* and formats (all template definitions) modified from:
* http://it.wikipedia.org/w/index.php?title=MediaWiki:Gadget-tb-base.js&oldid=66478020
* http://it.wikipedia.org/w/index.php?title=MediaWiki:Gadget-tb-* (for the templates)
* author Rotpunkt (http://it.wikipedia.org/wiki/Utente:Rotpunkt)
*
* Développement et maintenance :
 
{{Catégorisation JS|LiveRC}}
*/
//<source lang=javascript>
 
 
// =========== GET EXTENSION FROM IT.WIKI =========== 
 
 
mw.loader.load('//it.wikipedia.org/w/index.php?title='
             + 'MediaWiki:Gadget-LiveRC 1x.js/InserisciTemplate.js'
             + '&action=raw&ctype=text/javascript'
);
 
 
// =============== PARAMS FOR FR.WIKI =============== 
 
 
function AddComplexTemplateExtension_Init(){
  lstMyTemplate = {
    'Ébauche': { 
      template:'Ébauche',
      string:'Ébauche',
      where:'top',
      noinclude: false,
      subst: false,
      parameters: {
              "1":     {name: 'Thème 1',     type: 'select'},
              "2":     {name: 'Thème 2',     type: 'select'},
              "3":     {name: 'Thème 3',     type: 'select'},
              "4":     {name: 'Thème 4',     type: 'select'},
              "5":     {name: 'Thème 5',     type: 'select'},
              "6":     {name: 'Thème 6',     type: 'select'}
      }
    },
    'À fusionner':{
      template:'À fusionner',
      string:'À fusionner',
      where:'top',
      noinclude: false,
      subst: false,
      parameters: {
              "1":          {name: 'Article 1',        type: 'string'},
              "2":          {name: 'Article 2',        type: 'string'},
              "3":          {name: 'Article 3',        type: 'string'},
              "4":          {name: 'Article 4',        type: 'string'},
              "5":          {name: 'Article 5',        type: 'string'},
              "6":          {name: 'Article 6',        type: 'string'},
              "section FT": {name: 'Titre de section', type: 'string'}
      }
    },
    'Fusion technique':{
      template:'Fusion technique',
      string:'Fusion technique',
      where:'top',
      noinclude: false,
      subst: false,
      parameters: {
              "1":          {name: 'Article 1',        type: 'string'},
              "2":          {name: 'Article 2',        type: 'string'},
              "3":          {name: 'Article 3',        type: 'string'},
              "4":          {name: 'Article 4',        type: 'string'},
              "5":          {name: 'Article 5',        type: 'string'},
              "6":          {name: 'Article 6',        type: 'string'},
              "section FT": {name: 'Titre de section', type: 'string'}
      }
    }
  };
 
  AddComplexTemplateExtension_getEbaucheParams();
}
LiveRC_AddHook("AfterOptions", AddComplexTemplateExtension_Init);
 
 
// ===== GET PARAMS FOR {{Ébauche}} =====
 
 
function AddComplexTemplateExtension_getEbaucheParams(ParamList, apcontinue){
  if(!ParamList){ 
    ParamList = new Array();
    ParamList.push("");
  }
  if(!apcontinue) apcontinue = "";
  var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query'
          + '&list=allpages'
          + '&apnamespace=10'
          + '&aplimit='+LiveRC_Config["UserInfos"].APIlimit
          + '&apprefix=Ébauche/paramètres%20'
          + '&apfilterredir=nonredirects'
          + apcontinue; 
  wpajax.http({url:URL,
               onSuccess:AddComplexTemplateExtension_getEbaucheParamsDone,
               list:ParamList
  });
}
 
function AddComplexTemplateExtension_getEbaucheParamsDone(Req, data){
  var ParamList = data.list;
  var ObjectXML = Req.responseXML;
  var pages = ObjectXML.getElementsByTagName('p');
  for(var a=0,l=pages.length;a<l;a++){
    var page = pages[a];
    var title = page.getAttribute("title").split('Ébauche/paramètres ')[1];
    if(!title || title == "?" ) continue;
    if(ParamList.indexOf(title)==-1) ParamList.push(title);
  }
  var MustContinue = ObjectXML.getElementsByTagName('query-continue')[0];
  if(MustContinue && MustContinue.getElementsByTagName("allpages")[0]){
    var apcontinue = "&apcontinue=" + encodeURIComponent(MustContinue.getElementsByTagName("allpages")[0].getAttribute("apcontinue"));
    AddComplexTemplateExtension_getEbaucheParams(ParamList, apcontinue);
  }else{
    try{
      var Params = lstMyTemplate['Ébauche'].parameters;
      for(var paramname in Params){
        if(!Params.hasOwnProperty(paramname)) continue;
        lstMyTemplate['Ébauche'].parameters[paramname].value = ParamList;
      }
    }catch(e){
      lrcDisplayDebug("Failed to get {{Ébauche}} params");
    };
  }
}
 
//</nowiki></pre></source>
/* 
 --------------------------------------------------------------------------------------
 ---------LLLL---------III--------------------------RRRRRRRRRR--------CCCCC------------
 ---------LLLL---------III--------------------------RRRRRRRRRRRR----CCCCCCCCC----------
 ---------LLLL--------------------------------------RRR------RRR---CCC-----CCC---------
 ---------LLLL---------III--VV-----VV--EEEEEEEEE----RRR------RRR--CCC------------------
 ---------LLLL---------III---VV---VV---EEE----------RRRRRRRRRRR---CCC------------------
 ---------LLLL---------III---VV---VV---EEEEEE-------RRRRRRRRRR----CCC------------------
 ---------LLLL---------III----VV-VV----EEEEEE-------RRR-----RRR----CCC-----CCC---------
 ---------LLLLLLLLLLL--III----VVVVV----EEE----------RRR------RRR----CCCCCCCCC----------
 ---------LLLLLLLLLLL--III-----VVV-----EEEEEEEEE----RRR-------RRR-----CCCCC------------
 --------------------------------------------------------------------------------------
 
'''Extension de LiveRC'''
 
Permet d'améliorer la prévisualisation avec les fonctions du Common.js : 
déplacement des liens [modifier],
Modèle Images,
Géolocalisation multiple,
Boîtes déroulantes,
Palettes de navigation,
Affichage/Masquage du sommaire.
 
* Licence : ...?
* Documentation :
* Auteur : [[:fr:User:Dr Brains]]
* Développement et maintenance :
 
 
{{Catégorisation JS|LiveRC}}
 
<source lang=javascript> */
if (typeof(lrcHooks)!="undefined") { // DÉBUT IF
 
function RunCommonJS(){
   if(mw.config.get('wgPageName') != lrcMakeParam("PageTitle")) return;
   var preview = document.getElementById("livePreview");
   if(!preview) return;
   if(typeof(tocHideText)=='undefined' || typeof(tocShowText)=='undefined'){ 
      try{
         tocHideText = lrcGetMediawikiMessage("hidetoc");
         tocShowText = lrcGetMediawikiMessage("showtoc");
      }catch(e){
         tocHideText = "masquer";
         tocShowText = "afficher"; 
      }
   }
   try{setModifySectionStyle(preview);}catch(e){}    // déplacement des liens [modifier]
   try{imageGroup(preview);}catch(e){}               // Modèles {{Images}}
   try{Diaporama.Fonctions.Init(preview);}catch(e){} // Modèle {{Animation}}
   try{GeoBox_Init(preview);}catch(e){}              // Géolocalisation multiple
   try{BoiteDeroulante(preview);}catch(e){}          // Boîtes déroulantes
   try{Palette(preview);}catch(e){}                  // Palettes de navigation
   var TOC = getElementWithId("toc", "table", preview); // Sommaire
   if(TOC && typeof(showTocToggle)=="function"){
      showTocToggle();
      if(TOC.getElementsByTagName('ul')[0].style.display != "none") TOC.getElementsByTagName('ul')[0].style.display = "none";
   }
}
 
////////////////////////////////////////// HOOKS
 
LiveRC_AddHook("AfterPreviewDiff", RunCommonJS);
LiveRC_AddHook("AfterPreviewArticle", RunCommonJS);
LiveRC_AddHook("AfterPreviewHistory", RunCommonJS);
LiveRC_AddHook("AfterPreviewContribs", RunCommonJS);
LiveRC_AddHook("AfterPreviewDeletedContribs", RunCommonJS);
LiveRC_AddHook("AfterPreviewEdit", RunCommonJS);
LiveRC_AddHook("AfterPreviewLog", RunCommonJS);
LiveRC_AddHook("AfterPreviewFilter", RunCommonJS);
LiveRC_AddHook("AfterPreviewMove", RunCommonJS);
LiveRC_AddHook("AfterPreviewProtect", RunCommonJS);
LiveRC_AddHook("AfterPreviewDelete", RunCommonJS);
LiveRC_AddHook("AfterPreviewBlock", RunCommonJS);
LiveRC_AddHook("AfterPreviewRevisiondelete", RunCommonJS);
LiveRC_AddHook("AfterPreviewWhatlinkshere", RunCommonJS);
LiveRC_AddHook("AfterPreviewFeedback", RunCommonJS);
 
/* ************************************************************************************************************************************************ */
} // FIN IF
//</source>