MediaWiki:Common.js: mudanças entre as edições
Aparência
Sem resumo de edição |
Sem resumo de edição |
||
| Linha 14: | Linha 14: | ||
/* Tabela NR 04 Anexo 1 */ | /* Tabela NR 04 Anexo 1 */ | ||
$(function() { | $(function() { | ||
// | // Função genérica para alternar visibilidade e limpar descendentes | ||
$('.linha-nivel-1 | $('.linha-nivel-1, .linha-nivel-2, .linha-nivel-3').on('click', function(e) { | ||
e.stopPropagation(); | e.stopPropagation(); | ||
$(this). | |||
var nivelAtual = parseInt($(this).attr('class').match(/linha-nivel-(\d)/)[1]); | |||
var proximoNivel = nivelAtual + 1; | |||
// Se a linha já estiver aberta, estamos fechando (recolhendo) | |||
if ($(this).hasClass('aberto')) { | |||
// Remove a classe 'aberto' desta linha | |||
$(this).removeClass('aberto'); | |||
// Fecha todos os descendentes (recursivo) | |||
$(this).nextUntil('.linha-nivel-' + nivelAtual).removeClass('show aberto'); | |||
} else { | |||
// Se estamos abrindo: | |||
$(this).addClass('aberto'); | |||
// Mostra apenas os filhos imediatos (do próximo nível) | |||
$(this).nextUntil('.linha-nivel-' + nivelAtual).filter('.linha-nivel-' + proximoNivel).addClass('show'); | |||
} | |||
}); | }); | ||
}); | }); | ||
Edição das 21h57min de 14 de julho de 2026
/* Página Normas - Texto Principal Lógica para Ativação de Notas Explicativas no texto de Norma/Anexo */
$(document).ready(function() {
// Varre todas as notas sobrescritas que possuem conteúdo vindo do banco
$('.item-nr .nota-sup').each(function() {
var textoNota = $(this).text().trim();
// Se a nota contiver texto (ex: [1]), transforma esse texto no Tooltip oficial
if (textoNota && textoNota !== "[]") {
$(this).attr('title', 'Nota Explicativa ' + textoNota);
}
});
});
/* Tabela NR 04 Anexo 1 */
$(function() {
// Função genérica para alternar visibilidade e limpar descendentes
$('.linha-nivel-1, .linha-nivel-2, .linha-nivel-3').on('click', function(e) {
e.stopPropagation();
var nivelAtual = parseInt($(this).attr('class').match(/linha-nivel-(\d)/)[1]);
var proximoNivel = nivelAtual + 1;
// Se a linha já estiver aberta, estamos fechando (recolhendo)
if ($(this).hasClass('aberto')) {
// Remove a classe 'aberto' desta linha
$(this).removeClass('aberto');
// Fecha todos os descendentes (recursivo)
$(this).nextUntil('.linha-nivel-' + nivelAtual).removeClass('show aberto');
} else {
// Se estamos abrindo:
$(this).addClass('aberto');
// Mostra apenas os filhos imediatos (do próximo nível)
$(this).nextUntil('.linha-nivel-' + nivelAtual).filter('.linha-nivel-' + proximoNivel).addClass('show');
}
});
});