MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
document.addEventListener("DOMContentLoaded", function() { | |||
const collapsibleHeaders = document.querySelectorAll('.infobox-header'); | |||
collapsibleHeaders.forEach(function(header) { | |||
header.addEventListener('click', function() { | |||
const group = header.parentElement; | |||
group.classList.toggle('open'); | |||
const content = group.querySelector('.infobox-content'); | |||
} | if (content) { | ||
content.style.display = group.classList.contains('open') ? 'block' : 'none'; | |||
} | |||
}); | |||
}); | |||
}); | }); |
Revision as of 00:57, 14 January 2025
document.addEventListener("DOMContentLoaded", function() { const collapsibleHeaders = document.querySelectorAll('.infobox-header'); collapsibleHeaders.forEach(function(header) { header.addEventListener('click', function() { const group = header.parentElement; group.classList.toggle('open'); const content = group.querySelector('.infobox-content'); if (content) { content.style.display = group.classList.contains('open') ? 'block' : 'none'; } }); }); });