Diferencia entre revisiones de «MediaWiki:Common.js»
Apariencia
Página creada con «→Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página: document.addEventListener("DOMContentLoaded", function() { var items = document.querySelectorAll("#mw-panel .portal > ul > li"); items.forEach(function(item) { item.addEventListener("click", function(event) { var subMenu = this.querySelector("ul"); if (subMenu) { event.preventDefault(); s…» |
Sin resumen de edición |
||
Línea 1: | Línea 1: | ||
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */ | /* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */ | ||
document. | $(document).ready(function() { | ||
// Manejo del botón de ocultar/mostrar | |||
$('.mw-portlet h3').click(function() { | |||
$(this).next('div').toggle(); | |||
}); | |||
// Expansión de elementos con ":expand" | |||
$('.mw-portlet li:contains(":expand")').each(function() { | |||
$(this).html('<span class="toggle">▼</span> ' + $(this).html().replace(':expand ', '')); | |||
$(this).click(function() { | |||
$(this).children('ul').toggle(); | |||
}); | }); | ||
}); | }); | ||
}); | }); |
Revisión del 01:25 6 mar 2025
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */ $(document).ready(function() { // Manejo del botón de ocultar/mostrar $('.mw-portlet h3').click(function() { $(this).next('div').toggle(); }); // Expansión de elementos con ":expand" $('.mw-portlet li:contains(":expand")').each(function() { $(this).html('<span class="toggle">▼</span> ' + $(this).html().replace(':expand ', '')); $(this).click(function() { $(this).children('ul').toggle(); }); }); });