Jump to content

MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 7: Line 7:
         if (!$sidebar.length) return;
         if (!$sidebar.length) return;


         // 1. Identifica e esconde as subpáginas (procura por links ou links ativos que contenham a barra /)
         // 1. Identifica e esconde as subpáginas
         $sidebar.find('li').each(function() {
         $sidebar.find('li').each(function() {
             var $li = $(this);
             var $li = $(this);
Line 14: Line 14:
                             || $li.text().includes('Release Notes');
                             || $li.text().includes('Release Notes');
              
              
            // Garante que não apanha a página principal
             if (hasSubpage && !$li.text().includes('SENSBLUE ATLAS')) {
             if (hasSubpage && !$li.text().includes('SENSBLUE ATLAS')) {
                 $li.addClass('atlas-submenu');
                 $li.addClass('atlas-submenu');
Line 20: Line 19:
         });
         });


         // 2. Procura o item pai (SENSBLUE ATLAS) pelo texto, independentemente de ser link ou texto estático
         // 2. Procura o item pai (SENSBLUE ATLAS)
         var $mainAtlasLi = $sidebar.find('li').filter(function() {
         var $mainAtlasLi = $sidebar.find('li').filter(function() {
             var text = $(this).clone().children().remove().end().text().trim() || $(this).text().trim();
             var text = $(this).clone().children().remove().end().text().trim() || $(this).text().trim();
Line 32: Line 31:
                 'display': 'flex',
                 'display': 'flex',
                 'align-items': 'center',
                 'align-items': 'center',
                 'justify-content': 'space-between'
                 'justify-content': 'flex-start' // Move tudo para a esquerda juntinho
             });
             });


             // 3. Cria a seta
             // 3. Cria a seta colada ao texto
             var $toggleBtn = $('<span class="atlas-toggle-btn" style="cursor:pointer; margin-left:8px; user-select:none; font-weight:bold;">▶</span>');
             var $toggleBtn = $('<span class="atlas-toggle-btn" style="cursor:pointer; margin-left:8px; user-select:none; font-weight:bold;">▶</span>');
             $mainAtlasLi.append($toggleBtn);
             $mainAtlasLi.append($toggleBtn);  


             // 4. Evento do clique
             // 4. Evento do clique