Diferencia entre revisiones de «MediaWiki:Common.js»

De La Base Comunitaria de Conocimientos de la Economía Basada en Recursos
Saltar a: navegación, buscar
(These may be strict)
m (1 revisión)
 
(No se muestra una edición intermedia realizada por un usuario)
Línea 1: Línea 1:
 +
//Alias
 +
(function ( $, mw ) {
 
/**
 
/**
 
  * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
 
  * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
Línea 5: Línea 7:
 
  * optimized ResourceLoader modules with possibility to add dependencies etc.)
 
  * optimized ResourceLoader modules with possibility to add dependencies etc.)
 
  *
 
  *
  * Since Common.js isn't a gadget, there is no place to declare its
+
  * Since common.js isn't a gadget, there is no place to declare its
 
  * dependencies, so we have to lazy load them with mw.loader.using on demand and
 
  * dependencies, so we have to lazy load them with mw.loader.using on demand and
 
  * then execute the rest in the callback. In most cases these dependencies will
 
  * then execute the rest in the callback. In most cases these dependencies will
Línea 11: Línea 13:
 
  * dependency hasn't arrived yet it'll make sure those are loaded before this.
 
  * dependency hasn't arrived yet it'll make sure those are loaded before this.
 
  */
 
  */
/*global mw, $, importStylesheet, importScript */
+
mw.loader.using( 'mediawiki.util', function() {
/*jshint curly:false eqnull:true, strict:false, browser:true, */
+
mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () {
+
 
/* Begin of mw.loader.using callback */
 
/* Begin of mw.loader.using callback */
  
/**
+
//Compatibilidad
* Main Page layout fixes
+
 
*
+
/* Scripts specific to Internet Explorer */
* Description: Adds an additional link to the complete list of languages available.
+
if ($.client.profile().name == 'msie') {
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
+
    /**  
*/
+
    * Description: Fixes IE horizontal scrollbar bug
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
+
    * Maintainers: [[User:Tom-]]?
     $( document ).ready( function () {
+
    */
         mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
+
    var oldWidth;
            'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
+
    var docEl = document.documentElement;
     } );
+
 
 +
    var doFixIEScroll = function () {
 +
            docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
 +
    };
 +
 
 +
    var fixIEScroll = function () {
 +
            if (!oldWidth || docEl.clientWidth > oldWidth) {
 +
                doFixIEScroll();
 +
            } else {
 +
                setTimeout(doFixIEScroll, 1);
 +
            }
 +
 
 +
            oldWidth = docEl.clientWidth;
 +
    };
 +
 
 +
    document.attachEvent("onreadystatechange", fixIEScroll);
 +
    document.attachEvent("onresize", fixIEScroll);
 +
 
 +
    // In print IE (7?) does not like line-height
 +
    mw.util.addCSS('@media print { sup, sub, p { line-height: normal; } }');
 +
 
 +
    // IE overflow bug
 +
    mw.util.addCSS('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }');
 +
 
 +
    // IE zoomfix
 +
    // Use to fix right floating div/table inside tables
 +
    mw.util.addCSS('.iezoomfix div, .iezoomfix table { zoom: 1;}');
 +
 
 +
    /* Helper script for .hlist class in common.css
 +
    * Maintainer: [[User:Edokter]]
 +
    */
 +
    /* Add pseudo-selector class to last child list items in IE 8 */
 +
    if ( $.client.profile().versionBase == '8' ) {
 +
        $( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
 +
          .addClass( 'hlist-last-child' );
 +
     }
 +
    /* Generate interpuncts and parens for IE < 8 */
 +
    if ( $.client.profile().versionBase < '8' ) {
 +
         $( '.hlist' ).find( 'dt + dd, dt + dt' ).prev()
 +
          .append( '<b>:</b> ' );
 +
        $( '.hlist' ).find( 'dd + dd, dd + dt, li + li' ).prev()
 +
          .append( '<b>·</b> ' );
 +
        $( '.hlist' ).find( 'dl dl, ol ol, ul ul' )
 +
          .prepend( '( ' ).append( ') ' );
 +
     }
 
}
 
}
 +
 +
/* Fixes for Windows XP font rendering */
 +
if (navigator.appVersion.search(/windows nt 5/i) != -1) {
 +
    mw.util.addCSS('.IPA {font-family: "Lucida Sans Unicode", "Arial Unicode MS";} ' +
 +
                  '.Unicode {font-family: "Arial Unicode MS", "Lucida Sans Unicode";}');
 +
}
 +
 +
/* Helper script for .hlist class in common.css
 +
* Maintainer: [[User:Edokter]]
 +
*/
 +
 +
// Funcionalidad
  
 
/**
 
/**
 
  * Redirect User:Name/skin.js and skin.css to the current skin's pages
 
  * Redirect User:Name/skin.js and skin.css to the current skin's pages
 
  * (unless the 'skin' page really exists)
 
  * (unless the 'skin' page really exists)
  * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
+
  * @source: //www.mediawiki.org/wiki/Snippets/Redirect_skin.js
  * @rev: 2
+
  * @rev: 3
 
  */
 
  */
 
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
 
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
 
     var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
 
     var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
     /* Make sure there was a part before and after the slash
+
     // Make sure there was a part before and after the slash
      and that the latter is 'skin.js' or 'skin.css' */
+
    // And that the latter is 'skin.js' or 'skin.css'
 
     if ( titleParts.length == 2 ) {
 
     if ( titleParts.length == 2 ) {
         var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
+
         var userSkinPage = titleParts[0] + '/' + mw.config.get( 'skin' );
         if ( titleParts.slice( -1 ) == 'skin.js' ) {
+
         if ( titleParts[1] === 'skin.js' ) {
 
             window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
 
             window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
         } else if ( titleParts.slice( -1 ) == 'skin.css' ) {
+
         } else if ( titleParts[1] === 'skin.css' ) {
 
             window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
 
             window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
 
         }
 
         }
Línea 49: Línea 105:
 
}
 
}
  
/**
+
/** &withCSS= and &withJS= URL parameters *******
  * Map addPortletLink to mw.util
+
  * Allow to try custom scripts from MediaWiki space
  *
+
  * without editing personal .css or .js files
* @deprecated: Use mw.util.addPortletLink instead.
+
 
  */
 
  */
window.addPortletLink = function () {
+
var extraCSS = mw.util.getParamValue("withCSS");
     return mw.util.addPortletLink.apply( mw.util, arguments );
+
if (extraCSS && extraCSS.match(/^MediaWiki:[^&<>=%]*\.css$/)) {
};
+
     importStylesheet(extraCSS);
 +
}
 +
var extraJS = mw.util.getParamValue("withJS");
 +
if (extraJS && extraJS.match(/^MediaWiki:[^&<>=%]*\.js$/)) {
 +
    importScript(extraJS);
 +
}
  
/**
+
//Edición
  * Extract a URL parameter from the current URL
+
if ( $.inArray(mw.config.get('wgAction'), ['edit', 'submit'] ) > -1) {
*
+
    /** Fix edit summary prompt for undo ******************************************
  * @deprecated: Use mw.util.getParamValue with proper escaping
+
    * Fixes the fact that the undo function combined with the "no edit summary prompter"
  */
+
    * causes problems if leaving the edit summary unchanged.
window.getURLParamValue = function () {
+
    * Added by [[User:Deskana]], code by [[User:Tra]].
    return mw.util.getParamValue.apply( mw.util, arguments );
+
    * See also [[bugzilla:8912]].
};
+
    */
 +
    $(document).ready( function () {
 +
        if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) {
 +
            document.getElementsByName('wpAutoSummary')[0].value = '1';
 +
        }
 +
    });
 +
 
 +
    /**
 +
    * Caracteres especiales (edittools)
 +
    * Crea (y coloca) el ''combobox'' que permite seleccionar un conjunto determinado de
 +
    * caracteres especiales bajo la caja de edición.
 +
    * Funciona en conjunto con [[MediaWiki:Edittools]] y [[MediaWiki:Edittools.js]].
 +
    * Basado en [[commons:MediaWiki:Edittools.js]].
 +
    */
 +
    importScript('MediaWiki:Edittools.javascript');
  
/**  
+
    //Seguimiento
* Test if an element has a certain class
+
} else if (mw.config.get('wgPageName') == 'Especial:Seguimiento') {
 +
    mw.loader.load( mw.config.get('wgServer') + mw.config.get('wgScript') +
 +
        '?title=MediaWiki:Common.js/seguimiento.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 +
}
 +
 
 +
//Wikibugs
 +
importScript('MediaWiki:Wikibugs.js');
 +
 
 +
/** WikiMiniAtlas *******************************************************
 
  *
 
  *
  * @deprecatedUse $(element).hasClass() instead.
+
  * Description: WikiMiniAtlas is a popup click and drag world map.
 +
  *              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
 +
*              The script itself is located on meta because it is used by many projects.
 +
*              See [[Meta:WikiMiniAtlas]] for more information.
 +
*  Maintainers: [[User:Dschwen]]
 
  */
 
  */
window.hasClass = function ( element, className ) {
+
window.wma_settings = {
     return $( element ).hasClass( className );
+
     buttonImage: "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Erioll_world.svg/15px-Erioll_world.svg.png"
 
};
 
};
  
/**
+
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
+
* @rev 5
+
*/
+
// CSS
+
var extraCSS = mw.util.getParamValue( 'withCSS' );
+
if ( extraCSS ) {
+
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
+
importStylesheet( extraCSS );
+
} else {
+
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
+
}
+
}
+
  
// JS
+
/* OpenStreetMap */
var extraJS = mw.util.getParamValue( 'withJS' );
+
window.osm_proj_map = 'mapa'; //"map" in project language
if ( extraJS ) {
+
window.osm_proj_lang = 'es'; //project language
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
+
importScript( extraJS );
+
} else {
+
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
+
}
+
}
+
  
/**
+
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:OSM.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
* Import more specific scripts if necessary
+
*/
+
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
+
    /* scripts specific to editing pages */
+
    importScript( 'MediaWiki:Common.js/edit.js' );
+
} else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {
+
    /* watchlist scripts */
+
    importScript( 'MediaWiki:Common.js/watchlist.js' );
+
}
+
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
+
    /* file description page scripts */
+
    importScript( 'MediaWiki:Common.js/file.js' );
+
}
+
  
/**
+
/** Mejoras de diseño de la Portada
  * Load scripts specific to Internet Explorer
+
  *
 +
*  Descripción: Varias mejoras de diseño para la portada, incluyendo un
 +
*                      enlace adicional a la lista completa de idiomas disponibles.
 +
*  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
 +
*  Adaptado de [[en:MediaWiki:Common.js]]
 
  */
 
  */
if ( $.client.profile().name === 'msie' ) {
+
if ($.inArray(mw.config.get('wgPageName'), ['Wikipedia:Portada', 'Wikipedia Discusión:Portada']) > -1) {
     importScript( 'MediaWiki:Common.js/IEFixes.js' );
+
     $(document).ready(function () {
 +
        mw.util.addPortletLink('p-lang', '//es.wikipedia.org/wiki/Anexo:Wikipedias',
 +
            'Lista completa', 'interwiki-completelist', 'Lista completa de Wikipedias');
 +
    });
 
}
 
}
  
/**
+
// Oculta los resumenes de edición para ciertas páginas
* Fix for Windows XP Unicode font rendering
+
var paginasSinRE = [
*/
+
    "Wikipedia:Tablón_de_anuncios_de_los_bibliotecarios/Portal/Plantillas/Fusión_de_historiales/precarga",
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) {
+
    "Wikipedia:Tablón_de_anuncios_de_los_bibliotecarios/Portal/Plantillas/Permisos/precarga",
     mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' +
+
    "Wikipedia:Bot/Solicitudes/Precarga"
                '.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' );
+
];
 +
if ( $.inArray(mw.util.getParamValue('preload'), paginasSinRE ) > -1) {
 +
     $(document).ready(function () {
 +
        $('#wpSummary').hide();
 +
        $('#wpSummaryLabel').hide();
 +
    });
 
}
 
}
  
/**
+
/*
* WikiMiniAtlas
+
== Búsqueda especial extendida (specialsearch) ==
*
+
Añade a la página [[Special:Search]] enlaces a buscadores externos como Yahoo, Google, MSN Live y Exalead.
* Description: WikiMiniAtlas is a popup click and drag world map.
+
Basado en [[w:fr:MediaWiki:Monobook.js]].
*              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
+
*/
*              The script itself is located on meta because it is used by many projects.
+
if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
*              See [[Meta:WikiMiniAtlas]] for more information.  
+
 
* Maintainers: [[User:Dschwen]]
+
     /**
*/
+
    * Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche,
( function () {
+
    * disponibles dans une boîte déroulante.
     var require_wikiminiatlas = false;
+
    * Auteurs : Jakob Voss, Guillaume, importé depuis la Wiki allemande
     var coord_filter = /geohack/;
+
    * <pre><nowiki>
     $( document ).ready( function() {
+
    */
         $( 'a.external.text' ).each( function( key, link ) {
+
     var searchEngines = {
             if ( link.href && coord_filter.exec( link.href ) ) {
+
        mediawiki: {
                require_wikiminiatlas = true;
+
            ShortName: "Búsqueda interna",
                 // break from loop
+
            Template: mw.config.get('wgScript') + "?search={searchTerms}"
                 return false;
+
        },
 +
        exalead: {
 +
            ShortName: "Exalead",
 +
            Template: "http://www.exalead.com/search/wikipedia/results/?q={searchTerms}&language=es"
 +
        },
 +
        google: {
 +
            ShortName: "Google",
 +
            Template: "http://www.google.es/search?as_sitesearch=es.wikipedia.org&hl={language}&q={searchTerms}"
 +
        },
 +
        wikiwix: {
 +
            ShortName: "Wikiwix",
 +
            Template: "http://es.wikiwix.com/index.php?action={searchTerms}&lang={language}"
 +
        },
 +
        wlive: {
 +
            ShortName: "Bing",
 +
            Template: "http://www.bing.com/search?q={searchTerms}&q1=site:http://es.wikipedia.org"
 +
        },
 +
        yahoo: {
 +
            ShortName: "Yahoo!",
 +
            Template: "http://es.search.yahoo.com/search?p={searchTerms}&vs=es.wikipedia.org"
 +
        },
 +
        globalwpsearch: {
 +
            ShortName: "Global WP",
 +
            Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
 +
        }
 +
    };
 +
 
 +
     function changeSearchEngine(selectedId, searchTerms) {
 +
 
 +
        var currentId = document.getElementById("searchengineChoices").currentChoice;
 +
        if (selectedId == currentId) {
 +
            return;
 +
         }
 +
 
 +
        document.getElementById("searchengineChoices").currentChoice = selectedId;
 +
        var radio = document.getElementById('searchengineRadio-' + selectedId);
 +
        radio.checked = "checked";
 +
 
 +
        var engine = searchEngines[selectedId];
 +
        var p = engine.Template.indexOf('?');
 +
        var params = engine.Template.substr(p + 1);
 +
 
 +
        var form;
 +
        if (document.forms.search) {
 +
             form = document.forms.search;
 +
        } else {
 +
            form = document.getElementById("powersearch");
 +
        }
 +
        form.setAttribute("action", engine.Template.substr(0, p));
 +
 
 +
        var l = ("" + params).split("&"),
 +
            idx;
 +
        for (idx = 0; idx < l.length; idx++) {
 +
            var p2 = l[idx].split("=");
 +
            var pValue = p2[1];
 +
 
 +
            if (pValue == "{language}") {
 +
                 //
 +
            } else if (pValue == "{searchTerms}") {
 +
                 var input;
 +
                input = document.getElementById("searchText");
 +
 
 +
                input.name = p2[0];
 +
            } else {
 +
                var input2 = document.getElementById("searchengineextraparam");
 +
 
 +
                input2.name = p2[0];
 +
                input2.value = pValue;
 
             }
 
             }
        } );
 
        if ( $( 'div.kmldata' ).length ) {
 
            require_wikiminiatlas = true;
 
 
         }
 
         }
        if ( require_wikiminiatlas ) {
+
    }
            mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
+
 
 +
    function externalSearchEngines() {
 +
        if (typeof SpecialSearchEnhanced2Disabled != 'undefined') {
 +
            return;
 
         }
 
         }
    } );
 
} )();
 
  
/**
+
        var mainNode = document.getElementById("powersearch");
* Interwiki links to featured articles ***************************************
+
        if (!mainNode) {
*
+
            mainNode = document.getElementById("search");
* Description: Highlights interwiki links to featured articles (or
+
        }
*              equivalents) by changing the bullet before the interwiki link
+
        if (!mainNode) {
*              into a star.
+
            return;
* Maintainers: [[User:R. Koot]]
+
        }
*/
+
function LinkFA() {
+
    if ( document.getElementById( 'p-lang' ) ) {
+
        var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
+
  
         for ( var i = 0; i < InterwikiLinks.length; i++ ) {
+
         var beforeNode = document.getElementById("mw-search-top-table");
             if ( document.getElementById( InterwikiLinks[i].className + '-fa' ) ) {
+
        if (!beforeNode) {
                 InterwikiLinks[i].className += ' FA';
+
             return;
                 InterwikiLinks[i].title = 'This is a featured article in another language.';
+
        }
            } else if ( document.getElementById( InterwikiLinks[i].className + '-ga' ) ) {
+
        beforeNode = beforeNode.nextSibling;
                InterwikiLinks[i].className += ' GA';
+
        if (!beforeNode) {
                InterwikiLinks[i].title = 'This is a good article in another language.';
+
            return;
 +
        }
 +
 
 +
        var firstEngine = "mediawiki";
 +
 
 +
        var choices = document.createElement("div");
 +
        choices.setAttribute("id", "searchengineChoices");
 +
        choices.style.textAlign = "center";
 +
 
 +
        var lsearchbox = document.getElementById("searchText");
 +
        if (!lsearchbox) {
 +
            return;
 +
        }
 +
        var initValue = lsearchbox.value;
 +
 
 +
        var space = "",
 +
            id;
 +
 
 +
        for (id in searchEngines) {
 +
            var engine = searchEngines[id];
 +
            if (engine.ShortName) {
 +
                if (space) {
 +
                    choices.appendChild(space);
 +
                 }
 +
                space = document.createTextNode(" ");
 +
 
 +
                var attr = {
 +
                    type: "radio",
 +
                    name: "searchengineselect",
 +
                    value: id,
 +
                    onFocus: "changeSearchEngine(this.value)",
 +
                    id: "searchengineRadio-" + id
 +
                };
 +
 
 +
                var html = "<input",
 +
                    a;
 +
                 for (a in attr) {
 +
                    html += " " + a + "='" + attr[a] + "'";
 +
                }
 +
                html += " />";
 +
                var span = document.createElement("span");
 +
                span.innerHTML = html;
 +
 
 +
                choices.appendChild(span);
 +
                var label = document.createElement("label");
 +
                label.htmlFor = "searchengineRadio-" + id;
 +
                if (engine.Template.indexOf('http') == 0) {
 +
                    var lienMoteur = document.createElement("a");
 +
                    lienMoteur.href = engine.Template.replace("{searchTerms}", initValue).replace("{language}", "es");
 +
                    lienMoteur.appendChild(document.createTextNode(engine.ShortName));
 +
                    label.appendChild(lienMoteur);
 +
                } else {
 +
                    label.appendChild(document.createTextNode(engine.ShortName));
 +
                }
 +
 
 +
                choices.appendChild(label);
 
             }
 
             }
 
         }
 
         }
 +
        mainNode.insertBefore(choices, beforeNode);
 +
 +
        var input = document.createElement("input");
 +
        input.id = "searchengineextraparam";
 +
        input.type = "hidden";
 +
 +
        mainNode.insertBefore(input, beforeNode);
 +
 +
        changeSearchEngine(firstEngine, initValue);
 
     }
 
     }
 +
 +
    $(document).ready(externalSearchEngines);
 
}
 
}
  
$( LinkFA );
+
/*
 +
* Cerrar mensajes
 +
* Ver ejemplo en [[Usuario:Chabacano/Fírmalo]], por [[Usuario:Platonides]].
 +
*/
 +
if (document.getElementById("cierraPadre")) {
 +
    $(document).ready(function () {
 +
        document.getElementById("cierraPadre").childNodes[0].onclick = function () {
 +
            document.getElementById("cierraPadre").style.cursor = 'pointer';
 +
            document.getElementById("cierraPadre").parentNode.style.display = 'none';
 +
            return false; /*no seguir el href*/
 +
        };
 +
    });
 +
}
  
/**
+
/** Collapsible tables *********************************************************
* Collapsible tables *********************************************************
+
 
  *
 
  *
  * Description: Allows tables to be collapsed, showing only the header. See
+
  * Description: Allows tables to be collapsed, showing only the header. See
  *             [[Wikipedia:NavFrame]].
+
  *               [[Wikipedia:NavFrame]].
  * Maintainers: [[User:R. Koot]]
+
  * Maintainers: [[User:R. Koot]]
 
  */
 
  */
  
 
var autoCollapse = 2;
 
var autoCollapse = 2;
var collapseCaption = 'hide';
+
var collapseCaption = "ocultar";
var expandCaption = 'show';
+
var expandCaption = "mostrar";
  
window.collapseTable = function ( tableIndex ) {
+
window.collapseTable = function (tableIndex) {
     var Button = document.getElementById( 'collapseButton' + tableIndex );
+
     var Button = document.getElementById("collapseButton" + tableIndex),
    var Table = document.getElementById( 'collapsibleTable' + tableIndex );
+
        Table = document.getElementById("collapsibleTable" + tableIndex),
 +
        i;
  
     if ( !Table || !Button ) {
+
     if (!Table || !Button) {
 
         return false;
 
         return false;
 
     }
 
     }
  
 
     var Rows = Table.rows;
 
     var Rows = Table.rows;
    var i;
 
  
     if ( Button.firstChild.data === collapseCaption ) {
+
     if (Button.firstChild.data == collapseCaption) {
         for ( i = 1; i < Rows.length; i++ ) {
+
         for (i = 1; i < Rows.length; i++) {
             Rows[i].style.display = 'none';
+
             Rows[i].style.display = "none";
 
         }
 
         }
 
         Button.firstChild.data = expandCaption;
 
         Button.firstChild.data = expandCaption;
 
     } else {
 
     } else {
         for ( i = 1; i < Rows.length; i++ ) {
+
         for (i = 1; i < Rows.length; i++) {
 
             Rows[i].style.display = Rows[0].style.display;
 
             Rows[i].style.display = Rows[0].style.display;
 
         }
 
         }
Línea 222: Línea 427:
  
 
function createCollapseButtons() {
 
function createCollapseButtons() {
     var tableIndex = 0;
+
     var tableIndex = 0,
    var NavigationBoxes = {};
+
        NavigationBoxes = {},
    var Tables = document.getElementsByTagName( 'table' );
+
        Tables = document.getElementsByTagName("table"),
    var i;
+
        i;
  
    function handleButtonLink( index, e ) {
+
     for (i = 0; i < Tables.length; i++) {
        window.collapseTable( index );
+
         if ( $(Tables[i]).hasClass( 'collapsible' ) ) {
        e.preventDefault();
+
    }
+
 
+
     for ( i = 0; i < Tables.length; i++ ) {
+
         if ( $( Tables[i] ).hasClass( 'collapsible' ) ) {
+
  
 
             /* only add button and increment count if there is a header row to work with */
 
             /* only add button and increment count if there is a header row to work with */
             var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
+
             var HeaderRow = Tables[i].getElementsByTagName("tr")[0];
             if ( !HeaderRow ) continue;
+
             if (!HeaderRow) {
             var Header = HeaderRow.getElementsByTagName( 'th' )[0];
+
                continue;
             if ( !Header ) continue;
+
            }
 
+
             var Header = HeaderRow.getElementsByTagName("th")[0];
             NavigationBoxes[ tableIndex ] = Tables[i];
+
             if (!Header) {
            Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
+
                continue;
 +
             }
  
             var Button    = document.createElement( 'span' );
+
             NavigationBoxes[tableIndex] = Tables[i];
             var ButtonLink = document.createElement( 'a' );
+
             Tables[i].setAttribute("id", "collapsibleTable" + tableIndex);
            var ButtonText = document.createTextNode( collapseCaption );
+
  
             Button.className = 'collapseButton'; /* Styles are declared in Common.css */
+
             var Button = document.createElement("span");
 +
            var ButtonLink = document.createElement("a");
 +
            var ButtonText = document.createTextNode(collapseCaption);
  
 +
            Button.className = "collapseButton"; //Styles are declared in Common.css
 
             ButtonLink.style.color = Header.style.color;
 
             ButtonLink.style.color = Header.style.color;
             ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
+
             ButtonLink.setAttribute("id", "collapseButton" + tableIndex);
             ButtonLink.setAttribute( 'href', '#' );
+
             ButtonLink.setAttribute("href", "#");
             $( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) );
+
             addHandler(ButtonLink, "click", new Function("evt", "collapseTable(" + tableIndex + " ); return killEvt( evt );"));
             ButtonLink.appendChild( ButtonText );
+
             ButtonLink.appendChild(ButtonText);
  
             Button.appendChild( document.createTextNode( '[' ) );
+
             Button.appendChild(document.createTextNode("["));
             Button.appendChild( ButtonLink );
+
             Button.appendChild(ButtonLink);
             Button.appendChild( document.createTextNode( ']' ) );
+
             Button.appendChild(document.createTextNode("]"));
  
             Header.insertBefore( Button, Header.firstChild );
+
             Header.insertBefore(Button, Header.firstChild);
 
             tableIndex++;
 
             tableIndex++;
 
         }
 
         }
 
     }
 
     }
  
     for ( i = 0; i < tableIndex; i++ ) {
+
     for (i = 0; i < tableIndex; i++) {
         if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
+
         if ( $(NavigationBoxes[i]).hasClass( 'collapsed' ) || (tableIndex >= autoCollapse && $(NavigationBoxes[i]).hasClass( 'autocollapse' ) ) ) {
             window.collapseTable( i );
+
             window.collapseTable(i);
         }  
+
         } else if ( $(NavigationBoxes[i]).hasClass( 'innercollapse' ) ) {
        else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
+
 
             var element = NavigationBoxes[i];
 
             var element = NavigationBoxes[i];
             while ((element = element.parentNode)) {
+
             while (element = element.parentNode) {
                 if ( $( element ).hasClass( 'outercollapse' ) ) {
+
                 if ( $(element).hasClass( 'outercollapse' ) ) {
                     window.collapseTable ( i );
+
                     window.collapseTable(i);
 
                     break;
 
                     break;
 
                 }
 
                 }
Línea 281: Línea 483:
 
}
 
}
  
$( createCollapseButtons );
+
$(document).ready(createCollapseButtons);
  
/**
+
// == Código del plegado/desplegado de plantillas ==
* Dynamic Navigation Bars (experimental)
+
*
+
* Description: See [[Wikipedia:NavFrame]].
+
* Maintainers: UNMAINTAINED
+
*/
+
 
+
/* set up the words in your language */
+
 
var NavigationBarHide = '[' + collapseCaption + ']';
 
var NavigationBarHide = '[' + collapseCaption + ']';
 
var NavigationBarShow = '[' + expandCaption + ']';
 
var NavigationBarShow = '[' + expandCaption + ']';
  
/**
+
var NavigationBarShowDefault = 0;
* Shows and hides content and picture (if available) of navigation bars
+
 
* Parameters:
+
// shows and hides content and picture (if available) of navigation bars
*     indexNavigationBar: the index of navigation bar to be toggled
+
// Parameters:
**/
+
//     indexNavigationBar: the index of navigation bar to be toggled
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
+
window.toggleNavigationBar = function (indexNavigationBar) {
     var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
+
     var NavToggle = document.getElementById("NavToggle" + indexNavigationBar),
    var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
+
        NavFrame = document.getElementById("NavFrame" + indexNavigationBar),
    var NavChild;
+
        NavChild;
  
     if ( !NavFrame || !NavToggle ) {
+
     if (!NavFrame || !NavToggle) {
 
         return false;
 
         return false;
 
     }
 
     }
  
     /* if shown now */
+
     // if shown now
     if ( NavToggle.firstChild.data === NavigationBarHide ) {
+
     if (NavToggle.firstChild.data == NavigationBarHide) {
         for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
         for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
             if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
+
             if ( $(NavChild).hasClass( 'NavContent' ) || $(NavChild).hasClass( 'NavPic' ) ) {
 
                 NavChild.style.display = 'none';
 
                 NavChild.style.display = 'none';
 
             }
 
             }
 
         }
 
         }
    NavToggle.firstChild.data = NavigationBarShow;
+
        NavToggle.firstChild.data = NavigationBarShow;
  
    /* if hidden now */
+
        // if hidden now
     } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
+
     } else if (NavToggle.firstChild.data == NavigationBarShow) {
         for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
         for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
             if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
+
             if ( $(NavChild).hasClass( 'NavContent' ) || $(NavChild).hasClass( 'NavPic' ) ) {
 
                 NavChild.style.display = 'block';
 
                 NavChild.style.display = 'block';
 
             }
 
             }
Línea 326: Línea 521:
 
         NavToggle.firstChild.data = NavigationBarHide;
 
         NavToggle.firstChild.data = NavigationBarHide;
 
     }
 
     }
 
    event.preventDefault();
 
 
};
 
};
  
/* adds show/hide-button to navigation bars */
+
// adds show/hide-button to navigation bars
 
function createNavigationBarToggleButton() {
 
function createNavigationBarToggleButton() {
     var indexNavigationBar = 0;
+
     var indexNavigationBar = 0,
    var NavFrame;
+
     // iterate over all < div >-elements  
    var NavChild;
+
        divs = document.getElementsByTagName("div"),
     /* iterate over all < div >-elements */
+
        NavFrame,
    var divs = document.getElementsByTagName( 'div' );
+
        NavChild,
     for ( var i = 0; (NavFrame = divs[i]); i++ ) {
+
        i;
         /* if found a navigation bar */
+
     for (i = 0; NavFrame = divs[i]; i++) {
         if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
+
         // if found a navigation bar
 +
         if ( $(NavFrame).hasClass( 'NavFrame' ) ) {
  
 
             indexNavigationBar++;
 
             indexNavigationBar++;
             var NavToggle = document.createElement( 'a' );
+
             var NavToggle = document.createElement("a");
 
             NavToggle.className = 'NavToggle';
 
             NavToggle.className = 'NavToggle';
             NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
+
             NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
             NavToggle.setAttribute( 'href', '#' );
+
             NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
            $( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
+
  
             var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
+
             var isCollapsed = $(NavFrame).hasClass( 'collapsed' );
             /**
+
             /*
 
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
 
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
 
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
 
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
Línea 356: Línea 549:
 
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
 
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
 
             */
 
             */
             for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
+
             for (NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
                 if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
+
                 if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
                     if ( NavChild.style.display === 'none' ) {
+
                     if (NavChild.style.display == 'none') {
 
                         isCollapsed = true;
 
                         isCollapsed = true;
 
                     }
 
                     }
 
                 }
 
                 }
 
             }
 
             }
             if ( isCollapsed ) {
+
             if (isCollapsed) {
                 for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
                 for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
                     if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
+
                     if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
 
                         NavChild.style.display = 'none';
 
                         NavChild.style.display = 'none';
 
                     }
 
                     }
 
                 }
 
                 }
 
             }
 
             }
             var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
+
             var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide),
             NavToggle.appendChild( NavToggleText );
+
                j;
 +
             NavToggle.appendChild(NavToggleText);
  
             /* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
+
             // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
             for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
+
             for (j = 0; j < NavFrame.childNodes.length; j++) {
                 if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
+
                 if ( $(NavFrame.childNodes[j]).hasClass( 'NavHead' ) ) {
 
                     NavToggle.style.color = NavFrame.childNodes[j].style.color;
 
                     NavToggle.style.color = NavFrame.childNodes[j].style.color;
                     NavFrame.childNodes[j].appendChild( NavToggle );
+
                     NavFrame.childNodes[j].appendChild(NavToggle);
 
                 }
 
                 }
 
             }
 
             }
             NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
+
             NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
 
         }
 
         }
 
     }
 
     }
 
}
 
}
  
$( createNavigationBarToggleButton );
+
$(document).ready(createNavigationBarToggleButton);
  
/**
+
/** Interwiki links to featured articles ***************************************
* Uploadwizard_newusers
+
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
+
 
  *
 
  *
  * Maintainers: [[User:Krimpet]]
+
  * Description: Highlights interwiki links to featured articles (or
 +
*              equivalents) by changing the bullet before the interwiki link
 +
*              into a star.
 +
Maintainers: [[User:R. Koot]]
 
  */
 
  */
function uploadwizard_newusers() {
+
 
     if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) {
+
function LinkFA() {
         var oldDiv = document.getElementById( 'autoconfirmedusers' ),
+
     if (document.getElementById("p-lang")) {
            newDiv = document.getElementById( 'newusers' );
+
         var InterwikiLinks = document.getElementById("p-lang").getElementsByTagName("li"),
        if ( oldDiv && newDiv ) {
+
             InterwikiLinksLargo = InterwikiLinks.length,
             var userGroups = mw.config.get( 'wgUserGroups' );
+
             i;
             if ( userGroups ) {
+
 
                for ( var i = 0; i < userGroups.length; i++ ) {
+
        for (i = 0; i < InterwikiLinksLargo; i++) {
                    if ( userGroups[i] === 'autoconfirmed' ) {
+
            if (document.getElementById(InterwikiLinks[i].className + "-fa")) {
                        oldDiv.style.display = 'block';
+
                InterwikiLinks[i].className += " destacado";
                        newDiv.style.display = 'none';
+
                InterwikiLinks[i].title = "Este es un artículo destacado en esta Wikipedia.";
                        return;
+
            } else if (document.getElementById(InterwikiLinks[i].className + "-ga")) {
                    }
+
                 InterwikiLinks[i].className += " bueno";
                 }
+
                InterwikiLinks[i].title = "Este es un artículo bueno en esta Wikipedia.";
 
             }
 
             }
            oldDiv.style.display = 'none';
 
            newDiv.style.display = 'block';
 
            return;
 
 
         }
 
         }
 
     }
 
     }
 
}
 
}
  
$(uploadwizard_newusers);
+
$(document).ready(LinkFA);
  
 
/**
 
/**
  * Magic editintros ****************************************************
+
  * Enlace «sección nueva» junto a «editar» en la última sección de las páginas de discusión.
  *
+
  * Fuente: //de.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=107948391
* Description: Adds editintros on disambiguation pages and BLP pages.
+
* Maintainers: [[User:RockMFR]]
+
 
  */
 
  */
function addEditIntro( name ) {
+
$( function() {
     $( '.editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
+
     var newSectionLink = $( '#ca-addsection a' );
         el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
+
    if( newSectionLink.length ) {
     } );
+
        var link = newSectionLink.clone(); //create a copy
}
+
        //avoid duplicate accesskey
 +
        link.removeAttr( 'accesskey' ).attr( 'title', function ( index, oldTitle ) {
 +
            return oldTitle.replace( /\s*\[.*\]\s*$/, '' );
 +
         } );
 +
        // con la skin vector se muestra como "Sección nueva", pasamos a minúsculas para integrarlo mejor
 +
        link.css( {
 +
            "text-transform" : "lowercase"
 +
        } );
 +
        //add it wihin the brackets
 +
        var lastEditsectionLink = $( 'span.editsection:last a' );
 +
        lastEditsectionLink.after( link );
 +
        lastEditsectionLink.after( '&#32;·&#32;' ); //see [[MediaWiki:Pipe-separator]]
 +
     }
 +
} );
  
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
+
/*
    $( function () {
+
// == Interproyectos en un recuadro a la izquierda ==
         if ( document.getElementById( 'disambigbox' ) ) {
+
Funcionan con la plantilla {{ep|commons}} y en otras
             addEditIntro( 'Template:Disambig_editintro' );
+
[[:Categoría:Wikipedia:Plantillas_de_enlace_entre_proyectos|plantillas de enlace entre proyectos]]
 +
*/
 +
 
 +
function iProject() {
 +
    var elementos = [],
 +
         i;
 +
 
 +
    if (document.getElementsByClassName) {
 +
        elementos = document.getElementsByClassName("interProject");
 +
    } else {
 +
        var els = document.getElementsByTagName("span"),
 +
            elsLen = els.length,
 +
            j;
 +
        for (i = 0, j = 0; i < elsLen; i++) {
 +
             if ("interProject" == els[i].className) {
 +
                elementos[j] = els[i];
 +
                j++;
 +
            }
 
         }
 
         }
     } );
+
     }
 +
    if (elementos.length > 0) {
 +
        mw.util.addCSS('#interProject {display: none; speak: none;} #p-tb .pBody {padding-right: 0;}');
 +
        var portal = document.createElement('div');
 +
        portal.setAttribute("class", "portlet portal"); /* portlet en monobook, portal en vector */
  
    $( function () {
+
        var tit = document.createElement('h3');
         var cats = document.getElementById( 'mw-normal-catlinks' );
+
        tit.setAttribute("lang", "es");
         if ( !cats ) {
+
        tit.appendChild(document.createTextNode('Otros proyectos'));
             return;
+
        portal.appendChild(tit);
 +
 
 +
         var IPY = document.createElement('div');
 +
         IPY.setAttribute('class', "pBody body");
 +
        var ul = document.createElement('ul');
 +
        IPY.appendChild(ul);
 +
 
 +
        for (i = 0; i < elementos.length; i++) {
 +
             var li = document.createElement('li');
 +
            li.innerHTML = elementos[i].innerHTML;
 +
            ul.appendChild(li);
 
         }
 
         }
         cats = cats.getElementsByTagName( 'a' );
+
         portal.appendChild(IPY);
         for ( var i = 0; i < cats.length; i++ ) {
+
 
             if ( cats[i].title === 'Category:Living people' || cats[i].title === 'Category:Possibly living people' ) {
+
         if (document.getElementById("p-tb").nextSibling) {
                addEditIntro( 'Template:BLP_editintro' );
+
             document.getElementById("p-tb").parentNode.insertBefore(portal, document.getElementById("p-tb").nextSibling);
                break;
+
            }
+
 
         }
 
         }
    } );
+
        else {
 +
            document.getElementById("p-tb").parentNode.appendChild(portal);
 +
        }
 +
    }
 
}
 
}
 +
$(document).ready(iProject);
 +
 +
/* End of mw.loader.using callback */
 +
});
  
 
/**
 
/**
  * Description: Stay on the secure server as much as possible
+
  * Ordenación de tablas para seguir la convención de la RAE, SI y el Manual de Estilo
  * Maintainers: [[User:TheDJ]]
+
  * aún así se permite que el antigua sistema mantenga su comportamiento para no dañar
 +
* las miles de tablas sortable existentes de Wikipedia.
 +
* El script detecta si se usa la ordenación antigua (punto como separador de millares, y coma como separador de decimales)
 +
* o la nueva ordenación (espacio como separador de millares, y punto o coma como separador de decimales)
 +
* Aun así esto debería estar en mediaWiki y no aquí
 +
* Algo relacionado pero que no afecta las sortable directamente bug 34977
 +
*
 +
* Personaliza la ordenación de fechas
 +
* Se ordenan según "dd de mm de yy" o "dd de mm de yyyy"
 +
* También reconoce dd-mm-yy, dd-mm-yyyy (y otras variaciones usando / , .)
 
  */
 
  */
if ( document.location && document.location.protocol  && document.location.protocol === 'https:' ) {
+
mw.loader.using( 'jquery.tablesorter', function () {
     /* New secure servers */
+
     var ts = $.tablesorter,
    importScript( 'MediaWiki:Common.js/secure new.js' );
+
        i,
}
+
        j;
  
 +
    ts.formatDigit = function( s ) {
 +
        var i = parseFloat( s.replace( /[. ]/g, '' ).replace( /,/g, '.' ).replace( "\u2212", '-' ) );
 +
        return ( isNaN(i)) ? 0 : i;
 +
    };
 +
 +
    ts.formatDigitSI = function( s ) {
 +
        var i = parseFloat( s.replace( /[\u00a0\u202f ]/g, '' ).replace( /,/g, '.' ).replace( "\u2212", '-' ) );
 +
        return ( isNaN(i)) ? 0 : i;
 +
    };
 +
 +
    ts.numberRegexCustom  = new RegExp( "^[-+\u2212]?" +
 +
                                            "(?:" +
 +
                                                "([0-9]{1,3}[\\.])+?[0-9]{1,3}" +
 +
                                            "|" +
 +
                                                "[0-9]{1,4}" +
 +
                                            ")([\\,][0-9]+)?[\\s\\xa0]*%?$", "i" );
 +
    ts.numberRegexCustomSI = new RegExp( "^[-+\u2212]?" +
 +
                                            "(?:" +
 +
                                                "([0-9]{1,3}[\u00a0\u202f ])+?[0-9]{1,3}" +
 +
                                            "|" +
 +
                                                "[0-9]{1,4}" +
 +
                                            ")([\\.\\,][0-9]+)?[\\s\\xa0]*%?$", "i" );
 +
 +
    var regex = [];
 +
    ts.monthNames = [
 +
        [],
 +
        []
 +
    ];
 +
 +
    for ( i = 1; i < 13; i++ ) {
 +
        ts.monthNames[0][i] = mw.config.get( 'wgMonthNames' )[i].toLowerCase();
 +
        ts.monthNames[1][i] = mw.config.get( 'wgMonthNamesShort' )[i].toLowerCase().replace( '.', '' );
 +
        regex.push( $.escapeRE( ts.monthNames[0][i] ) );
 +
        regex.push( $.escapeRE( ts.monthNames[1][i] ) );
 +
    }
 +
    regex = regex.join( '|' );
 +
 +
    ts.fechaRegexCustom = [];
 +
    ts.fechaRegexCustom[0] = new RegExp( "^\\d\\d?\\sde\\s(" + regex + ")\\sde\\s\\d{2,4}$" );
 +
    ts.fechaRegexCustom[1] = new RegExp( "^(\\d\\d[\\/\\.\\-]\\d\\d[\\/\\.\\-]\\d\\d\\d\\d|\\d\\d[\\/\\.\\-]\\d\\d[\\/\\.\\-]\\d\\d)$" );
 +
 +
    $.tablesorter.addParser( {
 +
        id: 'numberSI',
 +
        is: function ( s, table ) {
 +
            return $.tablesorter.numberRegexCustomSI.test( $.trim( s ) );
 +
        },
 +
        format: function ( s ) {
 +
            return $.tablesorter.formatDigitSI( s );
 +
        },
 +
        type: 'numeric'
 +
    });
 +
 +
    $.tablesorter.addParser( {
 +
        id: 'numberCustom',
 +
        is: function ( s, table ) {
 +
            return $.tablesorter.numberRegexCustom.test( $.trim( s ) );
 +
        },
 +
        format: function ( s ) {
 +
            return $.tablesorter.formatDigit( s );
 +
        },
 +
        type: 'numeric'
 +
    });
 +
 +
    ts.addParser( {
 +
        id: 'fecha',
 +
        is: function( s ) {
 +
            return ( ts.fechaRegexCustom[0].test(s) || ts.fechaRegexCustom[1].test(s) );
 +
        },
 +
        format: function( s, table ) {
 +
            s = $.trim( s.toLowerCase() );
 +
 +
            for ( i = 1, j = 0; i < 13 && j < 2; i++ ) {
 +
                s = s.replace( ts.monthNames[j][i], i );
 +
                if ( i == 12 ) {
 +
                    j++;
 +
                    i = 0;
 +
                }
 +
            }
 +
 +
            s = s.replace( /( de |[\-\.\,' ])/g, '/' );
 +
 +
            // Replace double slashes
 +
            s = s.replace( /\/\//g, '/' );
 +
            s = s.replace( /\/\//g, '/' );
 +
            s = s.split( '/' );
 +
 +
            // Pad Month and Day
 +
            if ( s[0] && s[0].length == 1 ) {
 +
                s[0] = '0' + s[0];
 +
            }
 +
            if ( s[1] && s[1].length == 1 ) {
 +
                s[1] = '0' + s[1];
 +
            }
 +
            var y;
 +
 +
            if ( !s[2] ) {
 +
                // Fix yearless dates
 +
                s[2] = 2000;
 +
            } else if ( ( y = parseInt( s[2], 10) ) < 100 ) {
 +
                // Guestimate years without centuries
 +
                if ( y < 30 ) {
 +
                    s[2] = 2000 + y;
 +
                } else {
 +
                    s[2] = 1900 + y;
 +
                }
 +
            }
 +
            // Resort array depending on preferences
 +
            var d = s.shift();
 +
            s.push( s.shift() );
 +
            s.push(d);
 +
            return parseInt( s.join( '' ), 10 );
 +
        },
 +
        type: 'numeric'
 +
    } );
 
/* End of mw.loader.using callback */
 
/* End of mw.loader.using callback */
} );
+
});
/* DO NOT ADD CODE BELOW THIS LINE */
+
 
 +
/* Fin de alias */
 +
})( jQuery, mediaWiki );

Última revisión de 03:51 30 mar 2013

//Alias
(function ( $, mw ) {
/**
 * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
 * loaded for all users on every wiki page. If possible create a gadget that is
 * enabled by default instead of adding it here (since gadgets are fully
 * optimized ResourceLoader modules with possibility to add dependencies etc.)
 *
 * Since common.js isn't a gadget, there is no place to declare its
 * dependencies, so we have to lazy load them with mw.loader.using on demand and
 * then execute the rest in the callback. In most cases these dependencies will
 * be loaded (or loading) already and the callback will not be delayed. In case a
 * dependency hasn't arrived yet it'll make sure those are loaded before this.
 */
mw.loader.using( 'mediawiki.util', function() {
/* Begin of mw.loader.using callback */
 
//Compatibilidad
 
/* Scripts specific to Internet Explorer */
if ($.client.profile().name == 'msie') {
    /** 
     *  Description: Fixes IE horizontal scrollbar bug
     *  Maintainers: [[User:Tom-]]?
     */
    var oldWidth;
    var docEl = document.documentElement;
 
    var doFixIEScroll = function () {
            docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
    };
 
    var fixIEScroll = function () {
            if (!oldWidth || docEl.clientWidth > oldWidth) {
                doFixIEScroll();
            } else {
                setTimeout(doFixIEScroll, 1);
            }
 
            oldWidth = docEl.clientWidth;
    };
 
    document.attachEvent("onreadystatechange", fixIEScroll);
    document.attachEvent("onresize", fixIEScroll);
 
    // In print IE (7?) does not like line-height
    mw.util.addCSS('@media print { sup, sub, p { line-height: normal; } }');
 
    // IE overflow bug
    mw.util.addCSS('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }');
 
    // IE zoomfix
    // Use to fix right floating div/table inside tables
    mw.util.addCSS('.iezoomfix div, .iezoomfix table { zoom: 1;}');
 
    /* Helper script for .hlist class in common.css
     * Maintainer: [[User:Edokter]]
     */
    /* Add pseudo-selector class to last child list items in IE 8 */
    if ( $.client.profile().versionBase == '8' ) {
        $( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
          .addClass( 'hlist-last-child' );
    }
    /* Generate interpuncts and parens for IE < 8 */
    if ( $.client.profile().versionBase < '8' ) {
        $( '.hlist' ).find( 'dt + dd, dt + dt' ).prev()
          .append( '<b>:</b> ' );
        $( '.hlist' ).find( 'dd + dd, dd + dt, li + li' ).prev()
          .append( '<b>·</b> ' );
        $( '.hlist' ).find( 'dl dl, ol ol, ul ul' )
          .prepend( '( ' ).append( ') ' );
    }
}
 
/* Fixes for Windows XP font rendering */
if (navigator.appVersion.search(/windows nt 5/i) != -1) {
    mw.util.addCSS('.IPA {font-family: "Lucida Sans Unicode", "Arial Unicode MS";} ' + 
                   '.Unicode {font-family: "Arial Unicode MS", "Lucida Sans Unicode";}');
}
 
/* Helper script for .hlist class in common.css
 * Maintainer: [[User:Edokter]]
 */
 
// Funcionalidad
 
/**
 * Redirect User:Name/skin.js and skin.css to the current skin's pages
 * (unless the 'skin' page really exists)
 * @source: //www.mediawiki.org/wiki/Snippets/Redirect_skin.js
 * @rev: 3
 */
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) {
    var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
    // Make sure there was a part before and after the slash
    // And that the latter is 'skin.js' or 'skin.css'
    if ( titleParts.length == 2 ) {
        var userSkinPage = titleParts[0] + '/' + mw.config.get( 'skin' );
        if ( titleParts[1] === 'skin.js' ) {
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
        } else if ( titleParts[1] === 'skin.css' ) {
            window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
        }
    }
}
 
/** &withCSS= and &withJS= URL parameters *******
 * Allow to try custom scripts from MediaWiki space 
 * without editing personal .css or .js files
 */
var extraCSS = mw.util.getParamValue("withCSS");
if (extraCSS && extraCSS.match(/^MediaWiki:[^&<>=%]*\.css$/)) {
    importStylesheet(extraCSS);
}
var extraJS = mw.util.getParamValue("withJS");
if (extraJS && extraJS.match(/^MediaWiki:[^&<>=%]*\.js$/)) {
    importScript(extraJS);
}
 
//Edición
if ( $.inArray(mw.config.get('wgAction'), ['edit', 'submit'] ) > -1) {
    /** Fix edit summary prompt for undo  ******************************************
     *  Fixes the fact that the undo function combined with the "no edit summary prompter"
     *  causes problems if leaving the edit summary unchanged.
     *  Added by [[User:Deskana]], code by [[User:Tra]].
     *  See also [[bugzilla:8912]].
     */
    $(document).ready( function () {
        if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) {
            document.getElementsByName('wpAutoSummary')[0].value = '1';
        }
    });
 
    /**
     * Caracteres especiales (edittools)
     * Crea (y coloca) el ''combobox'' que permite seleccionar un conjunto determinado de
     * caracteres especiales bajo la caja de edición.
     * Funciona en conjunto con [[MediaWiki:Edittools]] y [[MediaWiki:Edittools.js]].
     * Basado en [[commons:MediaWiki:Edittools.js]].
     */
     importScript('MediaWiki:Edittools.javascript');
 
    //Seguimiento
} else if (mw.config.get('wgPageName') == 'Especial:Seguimiento') {
    mw.loader.load( mw.config.get('wgServer') + mw.config.get('wgScript') +
        '?title=MediaWiki:Common.js/seguimiento.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
}
 
//Wikibugs
importScript('MediaWiki:Wikibugs.js');
 
/** WikiMiniAtlas *******************************************************
 *
 *  Description: WikiMiniAtlas is a popup click and drag world map.
 *               This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
 *               The script itself is located on meta because it is used by many projects.
 *               See [[Meta:WikiMiniAtlas]] for more information. 
 *  Maintainers: [[User:Dschwen]]
 */
window.wma_settings = {
    buttonImage: "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Erioll_world.svg/15px-Erioll_world.svg.png"
};
 
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
/* OpenStreetMap */
window.osm_proj_map = 'mapa'; //"map" in project language
window.osm_proj_lang = 'es'; //project language
 
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:OSM.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
/** Mejoras de diseño de la Portada
 *
 *  Descripción: Varias mejoras de diseño para la portada, incluyendo un
 *                      enlace adicional a la lista completa de idiomas disponibles.
 *  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
 *  Adaptado de [[en:MediaWiki:Common.js]]
 */
if ($.inArray(mw.config.get('wgPageName'), ['Wikipedia:Portada', 'Wikipedia Discusión:Portada']) > -1) {
    $(document).ready(function () {
        mw.util.addPortletLink('p-lang', '//es.wikipedia.org/wiki/Anexo:Wikipedias',
            'Lista completa', 'interwiki-completelist', 'Lista completa de Wikipedias');
    });
}
 
// Oculta los resumenes de edición para ciertas páginas
var paginasSinRE = [
    "Wikipedia:Tablón_de_anuncios_de_los_bibliotecarios/Portal/Plantillas/Fusión_de_historiales/precarga",
    "Wikipedia:Tablón_de_anuncios_de_los_bibliotecarios/Portal/Plantillas/Permisos/precarga",
    "Wikipedia:Bot/Solicitudes/Precarga"
];
if ( $.inArray(mw.util.getParamValue('preload'), paginasSinRE ) > -1) {
    $(document).ready(function () {
        $('#wpSummary').hide();
        $('#wpSummaryLabel').hide();
    });
}
 
/*
== Búsqueda especial extendida (specialsearch) ==
Añade a la página [[Special:Search]] enlaces a buscadores externos como Yahoo, Google, MSN Live y Exalead.
Basado en [[w:fr:MediaWiki:Monobook.js]].
*/
if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
 
    /**
     * Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche,
     * disponibles dans une boîte déroulante.
     * Auteurs : Jakob Voss, Guillaume, importé depuis la Wiki allemande
     * <pre><nowiki>
     */
    var searchEngines = {
        mediawiki: {
            ShortName: "Búsqueda interna",
            Template: mw.config.get('wgScript') + "?search={searchTerms}"
        },
        exalead: {
            ShortName: "Exalead",
            Template: "http://www.exalead.com/search/wikipedia/results/?q={searchTerms}&language=es"
        },
        google: {
            ShortName: "Google",
            Template: "http://www.google.es/search?as_sitesearch=es.wikipedia.org&hl={language}&q={searchTerms}"
        },
        wikiwix: {
            ShortName: "Wikiwix",
            Template: "http://es.wikiwix.com/index.php?action={searchTerms}&lang={language}"
        },
        wlive: {
            ShortName: "Bing",
            Template: "http://www.bing.com/search?q={searchTerms}&q1=site:http://es.wikipedia.org"
        },
        yahoo: {
            ShortName: "Yahoo!",
            Template: "http://es.search.yahoo.com/search?p={searchTerms}&vs=es.wikipedia.org"
        },
        globalwpsearch: {
            ShortName: "Global WP",
            Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
        }
    };
 
    function changeSearchEngine(selectedId, searchTerms) {
 
        var currentId = document.getElementById("searchengineChoices").currentChoice;
        if (selectedId == currentId) {
            return;
        }
 
        document.getElementById("searchengineChoices").currentChoice = selectedId;
        var radio = document.getElementById('searchengineRadio-' + selectedId);
        radio.checked = "checked";
 
        var engine = searchEngines[selectedId];
        var p = engine.Template.indexOf('?');
        var params = engine.Template.substr(p + 1);
 
        var form;
        if (document.forms.search) {
            form = document.forms.search;
        } else {
            form = document.getElementById("powersearch");
        }
        form.setAttribute("action", engine.Template.substr(0, p));
 
        var l = ("" + params).split("&"),
            idx;
        for (idx = 0; idx < l.length; idx++) {
            var p2 = l[idx].split("=");
            var pValue = p2[1];
 
            if (pValue == "{language}") {
                //
            } else if (pValue == "{searchTerms}") {
                var input;
                input = document.getElementById("searchText");
 
                input.name = p2[0];
            } else {
                var input2 = document.getElementById("searchengineextraparam");
 
                input2.name = p2[0];
                input2.value = pValue;
            }
        }
    }
 
    function externalSearchEngines() {
        if (typeof SpecialSearchEnhanced2Disabled != 'undefined') {
            return;
        }
 
        var mainNode = document.getElementById("powersearch");
        if (!mainNode) {
            mainNode = document.getElementById("search");
        }
        if (!mainNode) {
            return;
        }
 
        var beforeNode = document.getElementById("mw-search-top-table");
        if (!beforeNode) {
            return;
        }
        beforeNode = beforeNode.nextSibling;
        if (!beforeNode) {
            return;
        }
 
        var firstEngine = "mediawiki";
 
        var choices = document.createElement("div");
        choices.setAttribute("id", "searchengineChoices");
        choices.style.textAlign = "center";
 
        var lsearchbox = document.getElementById("searchText");
        if (!lsearchbox) {
            return;
        }
        var initValue = lsearchbox.value;
 
        var space = "",
            id;
 
        for (id in searchEngines) {
            var engine = searchEngines[id];
            if (engine.ShortName) {
                if (space) {
                    choices.appendChild(space);
                }
                space = document.createTextNode(" ");
 
                var attr = {
                    type: "radio",
                    name: "searchengineselect",
                    value: id,
                    onFocus: "changeSearchEngine(this.value)",
                    id: "searchengineRadio-" + id
                };
 
                var html = "<input",
                    a;
                for (a in attr) {
                    html += " " + a + "='" + attr[a] + "'";
                }
                html += " />";
                var span = document.createElement("span");
                span.innerHTML = html;
 
                choices.appendChild(span);
                var label = document.createElement("label");
                label.htmlFor = "searchengineRadio-" + id;
                if (engine.Template.indexOf('http') == 0) {
                    var lienMoteur = document.createElement("a");
                    lienMoteur.href = engine.Template.replace("{searchTerms}", initValue).replace("{language}", "es");
                    lienMoteur.appendChild(document.createTextNode(engine.ShortName));
                    label.appendChild(lienMoteur);
                } else {
                    label.appendChild(document.createTextNode(engine.ShortName));
                }
 
                choices.appendChild(label);
            }
        }
        mainNode.insertBefore(choices, beforeNode);
 
        var input = document.createElement("input");
        input.id = "searchengineextraparam";
        input.type = "hidden";
 
        mainNode.insertBefore(input, beforeNode);
 
        changeSearchEngine(firstEngine, initValue);
    }
 
    $(document).ready(externalSearchEngines);
}
 
/*
 * Cerrar mensajes
 * Ver ejemplo en [[Usuario:Chabacano/Fírmalo]], por [[Usuario:Platonides]].
 */
if (document.getElementById("cierraPadre")) {
    $(document).ready(function () {
        document.getElementById("cierraPadre").childNodes[0].onclick = function () {
            document.getElementById("cierraPadre").style.cursor = 'pointer';
            document.getElementById("cierraPadre").parentNode.style.display = 'none';
            return false; /*no seguir el href*/
        };
    });
}
 
/** Collapsible tables *********************************************************
 *
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               [[Wikipedia:NavFrame]].
 *  Maintainers: [[User:R. Koot]]
 */
 
var autoCollapse = 2;
var collapseCaption = "ocultar";
var expandCaption = "mostrar";
 
window.collapseTable = function (tableIndex) {
    var Button = document.getElementById("collapseButton" + tableIndex),
        Table = document.getElementById("collapsibleTable" + tableIndex),
        i;
 
    if (!Table || !Button) {
        return false;
    }
 
    var Rows = Table.rows;
 
    if (Button.firstChild.data == collapseCaption) {
        for (i = 1; i < Rows.length; i++) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for (i = 1; i < Rows.length; i++) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
};
 
function createCollapseButtons() {
    var tableIndex = 0,
        NavigationBoxes = {},
        Tables = document.getElementsByTagName("table"),
        i;
 
    for (i = 0; i < Tables.length; i++) {
        if ( $(Tables[i]).hasClass( 'collapsible' ) ) {
 
            /* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables[i].getElementsByTagName("tr")[0];
            if (!HeaderRow) {
                continue;
            }
            var Header = HeaderRow.getElementsByTagName("th")[0];
            if (!Header) {
                continue;
            }
 
            NavigationBoxes[tableIndex] = Tables[i];
            Tables[i].setAttribute("id", "collapsibleTable" + tableIndex);
 
            var Button = document.createElement("span");
            var ButtonLink = document.createElement("a");
            var ButtonText = document.createTextNode(collapseCaption);
 
            Button.className = "collapseButton"; //Styles are declared in Common.css
            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute("id", "collapseButton" + tableIndex);
            ButtonLink.setAttribute("href", "#");
            addHandler(ButtonLink, "click", new Function("evt", "collapseTable(" + tableIndex + " ); return killEvt( evt );"));
            ButtonLink.appendChild(ButtonText);
 
            Button.appendChild(document.createTextNode("["));
            Button.appendChild(ButtonLink);
            Button.appendChild(document.createTextNode("]"));
 
            Header.insertBefore(Button, Header.firstChild);
            tableIndex++;
        }
    }
 
    for (i = 0; i < tableIndex; i++) {
        if ( $(NavigationBoxes[i]).hasClass( 'collapsed' ) || (tableIndex >= autoCollapse && $(NavigationBoxes[i]).hasClass( 'autocollapse' ) ) ) {
            window.collapseTable(i);
        } else if ( $(NavigationBoxes[i]).hasClass( 'innercollapse' ) ) {
            var element = NavigationBoxes[i];
            while (element = element.parentNode) {
                if ( $(element).hasClass( 'outercollapse' ) ) {
                    window.collapseTable(i);
                    break;
                }
            }
        }
    }
}
 
$(document).ready(createCollapseButtons);
 
// == Código del plegado/desplegado de plantillas ==
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
 
var NavigationBarShowDefault = 0;
 
// shows and hides content and picture (if available) of navigation bars
// Parameters:
//     indexNavigationBar: the index of navigation bar to be toggled
window.toggleNavigationBar = function (indexNavigationBar) {
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar),
        NavFrame = document.getElementById("NavFrame" + indexNavigationBar),
        NavChild;
 
    if (!NavFrame || !NavToggle) {
        return false;
    }
 
    // if shown now
    if (NavToggle.firstChild.data == NavigationBarHide) {
        for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if ( $(NavChild).hasClass( 'NavContent' ) || $(NavChild).hasClass( 'NavPic' ) ) {
                NavChild.style.display = 'none';
            }
        }
        NavToggle.firstChild.data = NavigationBarShow;
 
        // if hidden now
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
        for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if ( $(NavChild).hasClass( 'NavContent' ) || $(NavChild).hasClass( 'NavPic' ) ) {
                NavChild.style.display = 'block';
            }
        }
        NavToggle.firstChild.data = NavigationBarHide;
    }
};
 
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
    var indexNavigationBar = 0,
    // iterate over all < div >-elements 
        divs = document.getElementsByTagName("div"),
        NavFrame,
        NavChild,
        i;
    for (i = 0; NavFrame = divs[i]; i++) {
        // if found a navigation bar
        if ( $(NavFrame).hasClass( 'NavFrame' ) ) {
 
            indexNavigationBar++;
            var NavToggle = document.createElement("a");
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
 
            var isCollapsed = $(NavFrame).hasClass( 'collapsed' );
            /*
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
             * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
             * the content visible without JavaScript support), the new recommended way is to add the class
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
             */
            for (NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
                if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
                    if (NavChild.style.display == 'none') {
                        isCollapsed = true;
                    }
                }
            }
            if (isCollapsed) {
                for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
                    if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide),
                j;
            NavToggle.appendChild(NavToggleText);
 
            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
            for (j = 0; j < NavFrame.childNodes.length; j++) {
                if ( $(NavFrame.childNodes[j]).hasClass( 'NavHead' ) ) {
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
                    NavFrame.childNodes[j].appendChild(NavToggle);
                }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
}
 
$(document).ready(createNavigationBarToggleButton);
 
/** Interwiki links to featured articles ***************************************
 *
 *  Description: Highlights interwiki links to featured articles (or
 *               equivalents) by changing the bullet before the interwiki link
 *               into a star.
 *  Maintainers: [[User:R. Koot]]
 */
 
function LinkFA() {
    if (document.getElementById("p-lang")) {
        var InterwikiLinks = document.getElementById("p-lang").getElementsByTagName("li"),
            InterwikiLinksLargo = InterwikiLinks.length,
            i;
 
        for (i = 0; i < InterwikiLinksLargo; i++) {
            if (document.getElementById(InterwikiLinks[i].className + "-fa")) {
                InterwikiLinks[i].className += " destacado";
                InterwikiLinks[i].title = "Este es un artículo destacado en esta Wikipedia.";
            } else if (document.getElementById(InterwikiLinks[i].className + "-ga")) {
                InterwikiLinks[i].className += " bueno";
                InterwikiLinks[i].title = "Este es un artículo bueno en esta Wikipedia.";
            }
        }
    }
}
 
$(document).ready(LinkFA);
 
/**
 * Enlace «sección nueva» junto a «editar» en la última sección de las páginas de discusión.
 * Fuente: //de.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=107948391
 */
$( function() {
    var newSectionLink = $( '#ca-addsection a' );
    if( newSectionLink.length ) {
        var link = newSectionLink.clone(); //create a copy
        //avoid duplicate accesskey
        link.removeAttr( 'accesskey' ).attr( 'title', function ( index, oldTitle ) {
            return oldTitle.replace( /\s*\[.*\]\s*$/, '' );
        } );
        // con la skin vector se muestra como "Sección nueva", pasamos a minúsculas para integrarlo mejor
        link.css( {
            "text-transform" : "lowercase"
        } );
        //add it wihin the brackets
        var lastEditsectionLink = $( 'span.editsection:last a' );
        lastEditsectionLink.after( link );
        lastEditsectionLink.after( '&#32;·&#32;' ); //see [[MediaWiki:Pipe-separator]]
    }
} );
 
/*
// == Interproyectos en un recuadro a la izquierda ==
 Funcionan con la plantilla {{ep|commons}} y en otras
 [[:Categoría:Wikipedia:Plantillas_de_enlace_entre_proyectos|plantillas de enlace entre proyectos]]
*/
 
function iProject() {
    var elementos = [],
        i;
 
    if (document.getElementsByClassName) {
        elementos = document.getElementsByClassName("interProject");
    } else {
        var els = document.getElementsByTagName("span"),
            elsLen = els.length,
            j;
        for (i = 0, j = 0; i < elsLen; i++) {
            if ("interProject" == els[i].className) {
                elementos[j] = els[i];
                j++;
            }
        }
    }
    if (elementos.length > 0) {
        mw.util.addCSS('#interProject {display: none; speak: none;} #p-tb .pBody {padding-right: 0;}');
        var portal = document.createElement('div');
        portal.setAttribute("class", "portlet portal"); /* portlet en monobook, portal en vector */
 
        var tit = document.createElement('h3');
        tit.setAttribute("lang", "es");
        tit.appendChild(document.createTextNode('Otros proyectos'));
        portal.appendChild(tit);
 
        var IPY = document.createElement('div');
        IPY.setAttribute('class', "pBody body");
        var ul = document.createElement('ul');
        IPY.appendChild(ul);
 
        for (i = 0; i < elementos.length; i++) {
            var li = document.createElement('li');
            li.innerHTML = elementos[i].innerHTML;
            ul.appendChild(li);
        }
        portal.appendChild(IPY);
 
        if (document.getElementById("p-tb").nextSibling) {
            document.getElementById("p-tb").parentNode.insertBefore(portal, document.getElementById("p-tb").nextSibling);
        }
        else {
            document.getElementById("p-tb").parentNode.appendChild(portal);
        }
    }
}
$(document).ready(iProject);
 
/* End of mw.loader.using callback */
});
 
/**
 * Ordenación de tablas para seguir la convención de la RAE, SI y el Manual de Estilo
 * aún así se permite que el antigua sistema mantenga su comportamiento para no dañar
 * las miles de tablas sortable existentes de Wikipedia.
 * El script detecta si se usa la ordenación antigua (punto como separador de millares, y coma como separador de decimales)
 * o la nueva ordenación (espacio como separador de millares, y punto o coma como separador de decimales)
 * Aun así esto debería estar en mediaWiki y no aquí
 * Algo relacionado pero que no afecta las sortable directamente bug 34977
 * 
 * Personaliza la ordenación de fechas
 * Se ordenan según "dd de mm de yy" o "dd de mm de yyyy"
 * También reconoce dd-mm-yy, dd-mm-yyyy (y otras variaciones usando / , .)
 */
mw.loader.using( 'jquery.tablesorter', function () {
    var ts = $.tablesorter,
        i,
        j;
 
    ts.formatDigit = function( s ) {
        var i = parseFloat( s.replace( /[. ]/g, '' ).replace( /,/g, '.' ).replace( "\u2212", '-' ) );
        return ( isNaN(i)) ? 0 : i;
    };
 
    ts.formatDigitSI = function( s ) {
        var i = parseFloat( s.replace( /[\u00a0\u202f ]/g, '' ).replace( /,/g, '.' ).replace( "\u2212", '-' ) );
        return ( isNaN(i)) ? 0 : i;
    };
 
    ts.numberRegexCustom   = new RegExp( "^[-+\u2212]?" +
                                             "(?:" +
                                                 "([0-9]{1,3}[\\.])+?[0-9]{1,3}" +
                                             "|" +
                                                 "[0-9]{1,4}" +
                                             ")([\\,][0-9]+)?[\\s\\xa0]*%?$", "i" );
    ts.numberRegexCustomSI = new RegExp( "^[-+\u2212]?" +
                                             "(?:" +
                                                 "([0-9]{1,3}[\u00a0\u202f ])+?[0-9]{1,3}" +
                                             "|" +
                                                 "[0-9]{1,4}" +
                                             ")([\\.\\,][0-9]+)?[\\s\\xa0]*%?$", "i" );
 
    var regex = [];
    ts.monthNames = [
        [],
        []
    ];
 
    for ( i = 1; i < 13; i++ ) {
        ts.monthNames[0][i] = mw.config.get( 'wgMonthNames' )[i].toLowerCase();
        ts.monthNames[1][i] = mw.config.get( 'wgMonthNamesShort' )[i].toLowerCase().replace( '.', '' );
        regex.push( $.escapeRE( ts.monthNames[0][i] ) );
        regex.push( $.escapeRE( ts.monthNames[1][i] ) );
    }
    regex = regex.join( '|' );
 
    ts.fechaRegexCustom = [];
    ts.fechaRegexCustom[0] = new RegExp( "^\\d\\d?\\sde\\s(" + regex + ")\\sde\\s\\d{2,4}$" );
    ts.fechaRegexCustom[1] = new RegExp( "^(\\d\\d[\\/\\.\\-]\\d\\d[\\/\\.\\-]\\d\\d\\d\\d|\\d\\d[\\/\\.\\-]\\d\\d[\\/\\.\\-]\\d\\d)$" );
 
    $.tablesorter.addParser( {
        id: 'numberSI',
        is: function ( s, table ) {
            return $.tablesorter.numberRegexCustomSI.test( $.trim( s ) );
        },
        format: function ( s ) {
            return $.tablesorter.formatDigitSI( s );
        },
        type: 'numeric'
    });
 
    $.tablesorter.addParser( {
        id: 'numberCustom',
        is: function ( s, table ) {
            return $.tablesorter.numberRegexCustom.test( $.trim( s ) );
        },
        format: function ( s ) {
            return $.tablesorter.formatDigit( s );
        },
        type: 'numeric'
    });
 
    ts.addParser( {
        id: 'fecha',
        is: function( s ) {
            return ( ts.fechaRegexCustom[0].test(s) || ts.fechaRegexCustom[1].test(s) );
        },
        format: function( s, table ) {
            s = $.trim( s.toLowerCase() );
 
            for ( i = 1, j = 0; i < 13 && j < 2; i++ ) {
                s = s.replace( ts.monthNames[j][i], i );
                if ( i == 12 ) {
                    j++;
                    i = 0;
                }
            }
 
            s = s.replace( /( de |[\-\.\,' ])/g, '/' );
 
            // Replace double slashes
            s = s.replace( /\/\//g, '/' );
            s = s.replace( /\/\//g, '/' );
            s = s.split( '/' );
 
            // Pad Month and Day
            if ( s[0] && s[0].length == 1 ) {
                s[0] = '0' + s[0];
            }
            if ( s[1] && s[1].length == 1 ) {
                s[1] = '0' + s[1];
            }
            var y;
 
            if ( !s[2] ) {
                // Fix yearless dates
                s[2] = 2000;
            } else if ( ( y = parseInt( s[2], 10) ) < 100 ) {
                // Guestimate years without centuries
                if ( y < 30 ) {
                    s[2] = 2000 + y;
                } else {
                    s[2] = 1900 + y;
                }
            }
            // Resort array depending on preferences
            var d = s.shift();
            s.push( s.shift() );
            s.push(d);
            return parseInt( s.join( '' ), 10 );
        },
        type: 'numeric'
    } );
/* End of mw.loader.using callback */
});
 
/* Fin de alias */
})( jQuery, mediaWiki );
Herramientas personales
Espacios de nombres

Variantes
Acciones
Navegación
Herramientas
Compartir