MediaWiki:Vector.js: Difference between revisions

From Forklift Certified Video Games
Jump to navigation Jump to search
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Vector skin */
/* All JavaScript here will be loaded for users of the Vector skin */


document.addEventListener("click", function (e) {
document.addEventListener('click', function (e) {
if (!e.target.classList.contains("pf-collapsible")) return;
const header = e.target.closest('.pf-collapsible');
if (!header) return;


const content = e.target.nextElementSibling;
const targetId = header.dataset.target;
if (!content) return;
const section = document.getElementById(targetId);
if (!section) return;


content.classList.toggle("active");
const isOpen = section.style.display === 'block';
section.style.display = isOpen ? 'none' : 'block';
});
});

Revision as of 23:30, 21 January 2026

/* All JavaScript here will be loaded for users of the Vector skin */

document.addEventListener('click', function (e) {
	const header = e.target.closest('.pf-collapsible');
	if (!header) return;

	const targetId = header.dataset.target;
	const section = document.getElementById(targetId);
	if (!section) return;

	const isOpen = section.style.display === 'block';
	section.style.display = isOpen ? 'none' : 'block';
});