MediaWiki:Common.js : Différence entre versions

De geoLwiki - Guide géologique du Luxembourg
Ligne 210 : Ligne 210 :
 
   
 
   
 
addOnloadHook( createCollapseButtons );
 
addOnloadHook( createCollapseButtons );
 +
 +
 +
/*############################################################################################*/
 +
/* Compteur statistiques Wysistat (CTIE) , installé le 31/5/2011  =========================  */
 +
 +
document.write('<script language="javascript">var wysi=0;</script>');
 +
document.write('<script language="javascript" src="http://www.wysistat.com/statistique.js"></script>');
 +
document.write('<script language="javascript">if (wysi==1){wysistat("lu_geologie");}</script>');

Version du 31 mai 2011 à 11:56

/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */


/*############################################################################################*/
/* Boutons spplémentaires dans l'éditeur */


if (mwCustomEditButtons) {

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_enter.png",
     "speedTip": "Nouveau paragraphe",
     "tagOpen": "<br />",
     "tagClose": "",
     "sampleText": ""};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_liste.png",
     "speedTip": "Liste",
     "tagOpen": "* " ,
     "tagClose": "",
     "sampleText": "élément 1 \n* élément 2"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_enum.png",
     "speedTip": "Énumération",
     "tagOpen": "# ",
     "tagClose": "",
     "sampleText": "élément 1 \n# élément 2"};
/*

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_tableau.png",
     "speedTip": "Tableau",
     "tagOpen": "{| border="1" cellpadding="10" cellspacing="0"\n",
     "tagClose": "\n|}",
     "sampleText": "|Orange\n|Apple\n|-\n|Bread\n|Pie\n|-\n|Butter\n|Ice cream"};
*/
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_gallery.png",
     "speedTip": "Galerie d'images",
     "tagOpen": "<gallery>",
     "tagClose": "\n</gallery>",
     "sampleText": "\nImage:Exemple1.jpg|texte descriptif 1 \nImage:Exemple2.jpg|texte descriptif 2 \nImage:Exemple3.jpg|texte descriptif 3"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_modele.png",
     "speedTip": "Modèle",
     "tagOpen": "{{",
     "tagClose": "}}",
     "sampleText": "Nom du modèle"};


   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_category.png",
     "speedTip": "Catégorie",
     "tagOpen": "[[Catégorie:",
     "tagClose": "]]",
     "sampleText": "nom de la catégorie"};



   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_redirect.png",
     "speedTip": "Redirection",
     "tagOpen": "#REDIRECT [[",
     "tagClose": "]]",
     "sampleText": "Insert text"};
 

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.geologie.lu/geolwiki/skins/common/images/button_comment.png",
     "speedTip": "Commentaire visible uniquement aux éditeurs",
     "tagOpen": "<"+"!--",
     "tagClose": "--"+">",
     "sampleText": "Insérer commentaire ici"};

  }





/*############################################################################################*/
/* Commandes SOUS la fenêtre de l'éditeur   installé le 29/10/08  ==========================   */

function includePage( name )
{
document.write('<script type="text/javascript" src="' + wgScript + '?title='
  + name 
  + '&action=raw&ctype=text/javascript"><\/script>' 
);
}
/* End of includePage */
 
 
/* Including extra .js pages */ 
 
// switches for scripts
// TODO: migrate to JSConfig
// var load_extratabs = true;
var load_edittools = true;
 
// extra drop down menu on editing for adding special characters
includePage( 'MediaWiki:Edittools.js' );



/*############################################################################################*/
/* wikEd installation   le 05/11/08 RC ,  http://en.wikipedia.org/wiki/User:Cacycle/wikEd_installation==============   */

// install [[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"></' + 'script>');



/*############################################################################################*/
/* ################################## copié de http://meta.wikimedia.org/w/index.php?title=MediaWiki:Common.js  RC 07/11/08  */
/** Collapsible tables *********************************************************
  *
  *  Description: Allows tables to be collapsed, showing only the header. See
  *               [[Wikipedia:NavFrame]].
  *  Maintainer on Wikipedia: [[User:R. Koot]]
  */
 
var autoCollapse = 2;
var collapseCaption = "cacher ▲";
var expandCaption = "afficher ▼" ;
 
function hasClass( element, className ) {
  var Classes = element.className.split( " " );
  for ( var i = 0; i < Classes.length; i++ ) {
    if ( Classes[i] == className ) {
      return ( true );
    }
  }
  return ( false );
}

function collapseTable( tableIndex )
{
     var Button = document.getElementById( "collapseButton" + tableIndex );
     var Table = document.getElementById( "collapsibleTable" + tableIndex );
 
     if ( !Table || !Button ) {
         return false;
     }
 
     var Rows = Table.getElementsByTagName( "tr" ); 
 
     if ( Button.firstChild.data == collapseCaption ) {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = "none";
         }
         Button.firstChild.data = expandCaption;
     } else {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = Rows[0].style.display;
         }
         Button.firstChild.data = collapseCaption;
     }
}
 
function createCollapseButtons()
{
     var tableIndex = 0;
     var NavigationBoxes = new Object();
     var Tables = document.getElementsByTagName( "table" );
 
     for ( var i = 0; i < Tables.length; i++ ) {
         if ( hasClass( Tables[i], "collapsible" ) ) {
             NavigationBoxes[ tableIndex ] = Tables[i];
             Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
 
             var Button     = document.createElement( "span" );
             var ButtonLink = document.createElement( "a" );
             var ButtonText = document.createTextNode( collapseCaption );
 
             Button.style.styleFloat = "right";
             Button.style.cssFloat = "right";
             Button.style.fontWeight = "normal";
             Button.style.textAlign = "right";
             Button.style.width = "6em";
 
             ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
             ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
             ButtonLink.appendChild( ButtonText );
 
             Button.appendChild( document.createTextNode( "[" ) );
             Button.appendChild( ButtonLink );
             Button.appendChild( document.createTextNode( "]" ) );
 
             var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
             /* only add button and increment count if there is a header row to work with */
             if (Header) {
                 Header.insertBefore( Button, Header.childNodes[0] );
                 tableIndex++;
             }
         }
     }
 
     for ( var i = 0;  i < tableIndex; i++ ) {
         if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
             collapseTable( i );
         }
     }
}
 
addOnloadHook( createCollapseButtons );


/*############################################################################################*/
/* Compteur statistiques Wysistat (CTIE) , installé le 31/5/2011  =========================   */

document.write('<script language="javascript">var wysi=0;</script>');
document.write('<script language="javascript" src="http://www.wysistat.com/statistique.js"></script>');
document.write('<script language="javascript">if (wysi==1){wysistat("lu_geologie");}</script>');