Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.
- Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
- Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
- Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
/******************************************************************************* * Cualquier código JavaScript escrito aquí se cargará para todos los usuarios * en cada carga de página. * ----------------------------------------------------------------------------- * Por favor mantener el código en MediaWiki:Common.js al mínimo. Si es posible * crea un accesorio que esté activado por defecto en lugar de añadir el código * aquí (pues los accesorios están optimizados como módulos ResourceLoader que * les permite añadir dependencias entre otras cosas). Dado que Common.js no es * un accesorio, no hay forma de declarar sus dependencias, por lo que deben * cargarse manualmente con mw.loader.using a demanda y ejecutar el resto en la * retrollamada. * ****************************************************************************/ // Initialization of listing editor mw.loader.load( "//de.wikivoyage.org/w/index.php?title=MediaWiki:Gadget-ListingEditor.js&action=raw&ctype=text/javascript" ); mw.loader.using( ['mediawiki.util', 'jquery.client'], function () { /* COMIENZA: mw.loader.using callback */ /******************************************************************************* * COMIENZA: rwdImageMaps * * rwdImageMaps jQuery plugin v1.4 * * Allows image maps to be used in a responsive design by recalculating the area * coordinates to match the actual image size on load and window.resize * * Copyright (c) 2012 Matt Stow * https://github.com/stowball/jQuery-rwdImageMaps * http://mattstow.com * Licensed under the MIT license */ ;(function(a){a.fn.rwdImageMaps=function(){var d=this,c=parseFloat(a.fn.jquery);var b=function(){d.each(function(){if(typeof(a(this).attr("usemap"))=="undefined"){return}var f=this,e=a(f);a("<img />").on( 'load', function(){var o,k,i="width",n="height";if(c<1.6){o=f.getAttribute(i),k=f.getAttribute(n)}else{o=e.attr(i),k=e.attr(n)}if(!o||!k){var p=new Image();p.src=e.attr("src");if(!o){o=p.width}if(!k){k=p.height}}var g=e.width()/100,l=e.height()/100,j=e.attr("usemap").replace("#",""),m="coords";a('map[name="'+j+'"]').find("area").each(function(){var s=a(this);if(!s.data(m)){s.data(m,s.attr(m))}var r=s.data(m).split(","),q=new Array(r.length);for(var h=0;h<q.length;++h){if(h%2===0){q[h]=parseInt(((r[h]/o)*100)*g)}else{q[h]=parseInt(((r[h]/k)*100)*l)}}s.attr(m,q.toString())})}).attr("src",e.attr("src"))})};a(window).resize(b).trigger("resize");return this}})(jQuery); /* ↓↓↓↓ REVISAR si el siguiente código comentado aún es útil ↓↓↓↓ */ /* $(function() { $('img[usemap]').rwdImageMaps(); $('.banner-box').css('font-size',($('.banner-box').width()*0.03)+'px'); $('.banner-box').css('line-height',($('.banner-box').width()*0.08)+'px'); }); $(window).resize(function(e) { $('.banner-box').css('font-size',($('.banner-box').width()*0.03)+'px'); $('.banner-box').css('line-height',($('.banner-box').width()*0.08)+'px'); });*/ /* TERMINA:rwdImageMaps */ /******************************************************************************* * COMIENZA: ProportionalResize * This method will resize elements that have a class name of * "js-proportional-resize" by changing the font-size (%) based on a viewing * area width of 900px being the baseline, * i.e. 450px width=font size 50%, 900px width=font size 100%, 1800px width=font size 200%. * ****************************************************************************/ function proportionalResize() { var EXPECTED_PAGE_WIDTH = 900.00; $('.js-proportonal-resize').each(function() { var fontSizeCss= (($(this).width() / EXPECTED_PAGE_WIDTH) * 100.00) + '%'; $(this).css("font-size", fontSizeCss); }); } $(document).ready(function(e) { $('img[usemap]').rwdImageMaps(); proportionalResize(); }); $(window).on( 'load', function() { // the main page carousel text boxes aren't being initialized to the // correct size on IE, so add a second resize post-DOM-ready proportionalResize(); }); $(window).resize(function(e) { proportionalResize(); }); /* TERMINA: ProportionalResize */ /******************************************************************************* * COMIENZA: Añadir los botones de listados en la barra de herramientas * ****************************************************************************/ var customizeToolbar = function() { $( function() { if ( typeof $.fn.wikiEditor != 'undefined' ) { $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'reference' }); } }); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'main', 'groups': { 'listings': { 'label': 'Listados' // or use labelMsg for a localized label, see above } } } ); function currentLastEditDate() { // return the date as "2015-01-15" var d = new Date(); var year = d.getFullYear(); // Date.getMonth() returns 0-11 var month = d.getMonth() + 1; if (month < 10) month = '0' + month; var day = d.getDate(); if (day < 10) day = '0' + day; return year + '-' + month + '-' + day; } var CURRENT_LAST_EDIT_DATE = currentLastEditDate(); var LISTING_TOOLBAR_ITEMS = { 'see': { label: 'Listado ver', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Italian_traffic_signs_-_icona_museo.svg/22px-Italian_traffic_signs_-_icona_museo.svg.png', options: { pre: '* \{\{ver\n| nombre=', post: '| alt = | url = | email = \n| dirección = | lat = | long = | indicaciones = \n| tlf = | tlf_gratuito = | fax = \n| precio = | horario = \n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } }, 'do': { label: 'Listado hacer', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/30/Pictograms-nps-bicycle_trail-2.svg/22px-Pictograms-nps-bicycle_trail-2.svg.png', options: { pre: '* \{\{hacer\n| nombre=', post: ' | alt = | url = | email = \n| dirección = | lat = | long = | indicaciones = \n| tlf = | tlf_gratuito = | fax = \n| precio = | horario = \n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } }, 'buy': { label: 'Listado comprar', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Italian_traffic_signs_-_icona_supermercato.svg/22px-Italian_traffic_signs_-_icona_supermercato.svg.png', options: { pre: '* \{\{comprar\n| nombre=', post: ' | alt = | url = | email = \n| dirección = | lat = | long = | indicaciones = \n| tlf = | tlf_gratuito = | fax = \n| precio = | horario = \n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } }, 'eat': { label: 'Listado comer', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Italian_traffic_signs_-_icona_ristorante.svg/22px-Italian_traffic_signs_-_icona_ristorante.svg.png', options: { pre: '* \{\{comer\n| nombre=', post: ' | alt = | url = | email = \n| dirección = | lat = | long = | indicaciones = \n| tlf = | tlf_gratuito = | fax = \n| precio = | horario = \n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } }, 'drink': { label: 'Listado beber', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Verre_cocktail.svg/22px-Verre_cocktail.svg.png', options: { pre: '* \{\{beber\n| nombre=', post: ' | alt = | url = | email = \n| dirección = | lat = | long = | indicaciones = \n| tlf = | tlf_gratuito = | fax = \n| precio = | horario = \n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } }, 'sleep': { label: 'Listado dormir', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/25/Pictograms-nps-lodging.svg/22px-Pictograms-nps-lodging.svg.png', options: { pre: '* \{\{dormir\n| nombre=', post: ' | alt= | url= | email=\n| dirección= | lat= | long= | indicaciones=\n| tlf= | tlf_gratuito= | fax=\n| hora_entrada= | hora_salida= | precio=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } }, 'listing': { label: 'Otros listados', // or use labelMsg for a localized label, see above icon: '//upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Italian_traffic_signs_-_icona_informazioni.svg/22px-Italian_traffic_signs_-_icona_informazioni.svg.png', options: { pre: '* \{\{listado\n| nombre=', post: ' | alt= | url= | email=\n| dirección= | lat= | long= | indicaciones=\n| tlf= | tlf_gratuito= | fax=\n| horario= | precio=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '| imagen = | wikidata = | wikipedia = \n| descripción=\n}}' // text to be inserted } } }; $.each(LISTING_TOOLBAR_ITEMS, function(index, element) { $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'main', 'group': 'listings', 'tools': { 'Listings': { label: element.label, type: 'button', icon: element.icon, action: { type: 'encapsulate', options: element.options } } } } ); }); }; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */ /* No listings buttons in the wikitext editor if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) { mw.loader.using( 'user.options', function () { if ( mw.user.options.get('usebetatoolbar') ) { mw.loader.using( 'ext.wikiEditor', function () { $(document).ready( customizeToolbar ); } ); } } ); } */ /* TERMINA: Añadir los botones de listados en la barra de herramientas */ /******************************************************************************* * COMIENZA: Códigos para modificar el modo de 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]]. */ $( 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'); } /* TERMINA: Códigos para modificar el modo de edición */ /******************************************************************************* * COMIENZA: Resultados de Wikidata - [[File:Wdsearch_script_screenshot.png]] * ****************************************************************************/ if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' || ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) { mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript"); } /* TERMINA: Resultados de Wikidata */ /******************************************************************************* * COMIENZA: Código para la página de Seguimiento * ****************************************************************************/ if (mw.config.get('wgPageName') == 'Especial:Seguimiento') { mw.loader.load( mw.config.get('wgScript') + '?title=MediaWiki:Common.js/seguimiento.js&action=raw&ctype=text/javascript'); } /* TERMINA: Código para la página de Seguimiento */ /******************************************************************************* * COMIENZA: Corrección para el indicador GPX * ****************************************************************************/ $(".geo, #GPX-track").parents("#content").find("#mw-indicator-GPX").css("display","inline"); /* TERMINA: Corrección para el indicador GPX */ /******************************************************************************* * COMIENZA: Wikibugs (Herramienta de notificación de errores) * ****************************************************************************/ mw.loader.load( '/w/index.php?title=MediaWiki:Wikibugs.js&action=raw&ctype=text/javascript' ); /* TERMINA: Wikibugs */ /*============================================================================* * CÓDIGOS POSIBLEMENTE OBSOLETOS, EN DESUSO O SIN PROPÓSITO EN WIKIVIAJES * *============================================================================*/ /******************************************************************************* * COMIENZA: 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" }; /* TERMINA: WikiMiniAtlas */ /** 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", "#"); $(ButtonLink).on( "click", new Function("evt", "collapseTable(" + tableIndex + " ); return false;")); 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; } } } } } $(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); } } } $(createNavigationBarToggleButton); /******************************************************************************* * COMIENZA: Avisos de viaje * * Consulta los avisos a viajeros de [[Avisos de viaje/Wikiviajes]] ******************************************************************************/ // mw.loader.load( '/w/index.php?title=MediaWiki:Wikinoticias.js&action=raw&ctype=text/javascript' ); /* TERMINA: Avisos de viaje */ /* TERMINA: mw.loader.using callback */ } ); /* DO NOT ADD CODE BELOW THIS LINE */ //Ticker de la portada var width = $('.ticker-text').width(), containerwidth = $('.ticker-container').width(), left = containerwidth; $(document).ready(function(e){ function tick() { if(--left < -width){ left = containerwidth; } $(".ticker-text").css("margin-left", left + "px"); setTimeout(tick, 8); //El número indica la velocitat (Més petit més ràpid) } tick(); }); //END Ticker de la portada var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { /* Toggle between adding and removing the "active" class, to highlight the button that controls the panel */ this.classList.toggle("active"); /* Toggle between hiding and showing the active panel */ var panel = this.nextElementSibling; if (panel.style.display === "block") { panel.style.display = "none"; } else { panel.style.display = "block"; } }); }