MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
// ========================================================================== | // ========================================================================== | ||
// CONTROLADOR DE DROPDOWN | // CONTROLADOR DE DROPDOWN INDEPENDENTE NO ÍNDICE (TOC) - SEM HEADERS | ||
// ========================================================================== | // ========================================================================== | ||
// Procura | // Procura os itens de lista, mas ignora explicitamente o nó de boas-vindas/título principal | ||
$('#mw-panel-toc .vector-toc-list-item, .vector-page-titlebar-toc .vector-toc-list-item').each(function() { | $('#mw-panel-toc .vector-toc-list-item, .vector-page-titlebar-toc .vector-toc-list-item') | ||
.not('#sidebar-toc-welcome, .vector-toc-title, :has(> #vector-toc-collapsed-button)') | |||
.each(function() { | |||
var $listItem = $(this); | var $listItem = $(this); | ||
// | // Se for o link do cabeçalho geral (geralmente não tem numeração ou tem ID específico), sai fora | ||
if ($listItem. | if ($listItem.find('#vector-toc-collapsed-button').length > 0 || $listItem.hasClass('vector-toc-title')) { | ||
return; | return; | ||
} | } | ||
var $subList = $listItem.children('ul, .vector-toc-list'); | |||
// Só avança se a lista filha tiver | // Só avança se a lista filha tiver subcapítulos lá dentro | ||
if ($subList.length > 0 && $subList.children('li, .vector-toc-list-item').length > 0) { | if ($subList.length > 0 && $subList.children('li, .vector-toc-list-item').length > 0) { | ||