MediaWiki:Common.js: diferenças entre revisões
Aparência
Criou a página com "→Código Javascript colocado aqui será carregado para todos os utilizadores em cada carregamento de página: document.addEventListener('DOMContentLoaded', function () { document.querySelectorAll('.list-equip .button').forEach(function (button) { var details = button.parentElement.nextElementSibling; if (!details || !details.classList.contains('tabber-noactive')) { return; } button.addEventListener('click', function () { details.class..." |
Sem resumo de edição |
||
| Linha 12: | Linha 12: | ||
}); | }); | ||
}); | }); | ||
}); | |||
mw.loader.using('mediawiki.util').then(function () { | |||
$(function () { | |||
$('.list-equip .button').each(function () { | |||
var $button = $(this); | |||
var $details = $button.parent().next('.tabber-noactive'); | |||
if (!$details.length) { | |||
return; | |||
} | |||
$details.hide(); | |||
$button.css('cursor', 'pointer'); | |||
$button.off('click.equipdetails').on('click.equipdetails', function () { | |||
$details.slideToggle(150); | |||
$button.text($details.is(':visible') ? 'Ocultar' : 'Detalhes'); | |||
}); | |||
}); | |||
}); | |||
}); | }); | ||
Revisão das 18h27min de 29 de março de 2026
/* Código Javascript colocado aqui será carregado para todos os utilizadores em cada carregamento de página */
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.list-equip .button').forEach(function (button) {
var details = button.parentElement.nextElementSibling;
if (!details || !details.classList.contains('tabber-noactive')) {
return;
}
button.addEventListener('click', function () {
details.classList.toggle('is-open');
button.textContent = details.classList.contains('is-open') ? 'Ocultar' : 'Detalhes';
});
});
});
mw.loader.using('mediawiki.util').then(function () {
$(function () {
$('.list-equip .button').each(function () {
var $button = $(this);
var $details = $button.parent().next('.tabber-noactive');
if (!$details.length) {
return;
}
$details.hide();
$button.css('cursor', 'pointer');
$button.off('click.equipdetails').on('click.equipdetails', function () {
$details.slideToggle(150);
$button.text($details.is(':visible') ? 'Ocultar' : 'Detalhes');
});
});
});
});