MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
// ========================================================================== | // ========================================================================== | ||
// CONTROLADOR DE DROPDOWN | // CONTROLADOR DE DROPDOWN NO ÍNDICE (TOC) - VERSÃO VISUAL FINAL | ||
// ========================================================================== | // ========================================================================== | ||
$('.vector-toc-contents .vector-toc-list .vector-toc-list-item').each(function() { | $('.vector-toc-contents .vector-toc-list .vector-toc-list-item').each(function() { | ||
var $listItem = $(this); | var $listItem = $(this); | ||
// | // Proteção total ao cabeçalho global | ||
if ($listItem.find('.vector-toc-title, #vector-toc-collapsed-button, .vector-toc-header').length > 0 || $listItem.hasClass('vector-toc-title')) { | if ($listItem.find('.vector-toc-title, #vector-toc-collapsed-button, .vector-toc-header').length > 0 || $listItem.hasClass('vector-toc-title')) { | ||
return; | return; | ||
| Line 17: | Line 16: | ||
var $subList = $listItem.children('.vector-toc-list, ul'); | var $subList = $listItem.children('.vector-toc-list, ul'); | ||
// Só injeta | // Só injeta o botão se contiver subcapítulos | ||
if ($subList.length > 0 && $subList.children('.vector-toc-list-item, li').length > 0) { | if ($subList.length > 0 && $subList.children('.vector-toc-list-item, li').length > 0) { | ||
if ($listItem.children('.toc-toggle-arrow').length === 0) { | if ($listItem.children('.toc-toggle-arrow').length === 0) { | ||
var $arrow = $('<span class="toc-toggle-arrow"> | // Injeta o container da seta preparado para renderizar o SVG do CSS | ||
var $arrow = $('<span class="toc-toggle-arrow"><span class="arrow-icon"></span></span>'); | |||
$arrow.click(function(e) { | $arrow.click(function(e) { | ||
e.preventDefault(); | e.preventDefault(); | ||
| Line 31: | Line 29: | ||
}); | }); | ||
$listItem.prepend($arrow); | $listItem.prepend($arrow); | ||
} | } | ||